LEARN / OCEAN WAVES / CHAPTER 10

FFT and Spectral Moments

Full original scientific lesson and experiments, reorganized into a dedicated chapter.

Original physics and annotationsInteractive scientific demonstrationsScientific teaching examples

Scientific scope: This lesson retains the original scientific explanations, diagrams, equations and interactive demonstrations. All numerical examples are educational and subject to their stated assumptions; they are not independently field-validated engineering design tools or operational forecasts.

CHAPTER 10 / FREQUENCY SPECTRA & WAVE STATISTICS

From the time record
to the frequency spectrum.

A wave gauge records surface elevation through time. Fourier analysis asks which rhythms are present in that record. Follow one signal from sampled elevations to complex Fourier coefficients, then convert their squared magnitudes into a spectrum whose area measures variance.

01 Observe η(t)02 Resolve frequencies and phase03 Estimate S(f)04 Interpret weighted areas
ONE EXPERIMENT / TIME AND FREQUENCY

A · Surface elevation at a fixed sensor

The dark line joins samples taken every 0.05 s; the coloured line isolates the selected known component. The vertical scale stays at ±1.75 m. At the default A-only phase, the crest, trough and 0.90 m crest-to-trough bracket appear on this graph. Optional orange zero-upcrossing lines separate complete waves for H1/3. This is a synthetic record.

B · Resolve the signal into sinusoidal components

C · FFT periodogram and the prescribed reference

Tp · peak10.00 s Tm01 · m₀/m₁10.00 s Tm02 · √(m₀/m₂)10.00 s

The vertical markers sit at the inverse of each labelled period. Only Tp marks a highest component bar; the other two indicate moment-derived equivalent frequencies, not additional wave components. Each bar's area = a²/2 (m²), with fixed illustrative Δf = 0.010 Hz and S(f) in m²/Hz.

Turn on the FFT curve to see a finite-record estimate. The bars and reported Hm0/periods remain based on the exact prescribed components.

One component: one frequency bin and a perfectly repeating record.

SPECTRAL VARIANCE m₀0.1013 m²
SPECTRAL HEIGHT Hm01.27 m
RECORD HEIGHT H1/30.90 m
PEAK PERIOD Tp10.00 s
MEAN PERIOD Tm0110.00 s
MEAN ZERO-CROSSING ESTIMATE Tm0210.00 s

This independent component experiment uses the prescribed zero level for crossings; Chapter 9 instead removes the finite sample mean before segmenting its record. The height Hm0 and periods are calculated from the prescribed variance distribution. H1/3 comes from complete individual waves in this finite sampled trace. Neither is a field observation. Tm02 is a spectral estimate, not the arithmetic mean of detected crossing periods.

How was 0.90 m obtained?

For wave A, the crest is +0.45 m and the trough is −0.45 m: H = +0.45 − (−0.45) = 0.90 m.

What is the peak period?

The strongest bin is at 0.100 Hz; Tp = 1 / 0.100 = 10.00 s.

What are the mean periods?

First define the spectral moments: m₀ = ∫S(f)df (total variance, the area under the spectrum), m₁ = ∫fS(f)df and m₂ = ∫f²S(f)df. Then Tm01 = m₀/m₁ and Tm02 = √(m₀/m₂). They use the whole spectrum, not just the highest bar.

ANALYSIS / FROM THE RECORD TO THE COEFFICIENTS

An FFT is a calculation, not yet a spectrum.

The discrete Fourier transform compares the sampled signal with sine and cosine patterns at a set of frequencies. A complex coefficient records these two projections together: its magnitude describes the strength of the matching pattern and its argument describes phase. The fast Fourier transform is an efficient algorithm for computing exactly this transform. Panel B shows the known ingredients so that the result can be checked; the coefficient readout below it is calculated from the sampled signal, not copied from those ingredients.

To estimate variance density, first remove the sample mean, optionally taper the record, and then square and normalize the Fourier magnitudes. Combine matching positive and negative frequencies into a one-sided spectrum. Phase is absent from this density: two records can have the same underlying spectral variance but different arrangements of crests. For a short record, changing phase can also change leakage and its measured variance.

Read the spectrum as an area.

Variance is the average squared departure from the mean elevation. It measures the size of the fluctuations in m², not a crest-to-trough distance. In a spectrum, density times frequency width gives variance. A harmonic of amplitude 0.45 m contributes 0.45²/2 = 0.10125 m². Drawing that contribution in an illustrative 0.010 Hz-wide bin gives 10.125 m²/Hz. A narrower drawing bin would be taller without adding variance.

Worked moments · exact known components

The zeroth moment m₀ counts every contribution equally. The first moment m₁ weights it by frequency; m₁/m₀ is the variance-weighted mean frequency. The second moment m₂ weights it by frequency squared, making it more sensitive to rapid oscillations and high-frequency noise. Thus Tm01 is the inverse mean frequency, whereas Tm02 is the inverse root-mean-square frequency. The latter relates to the mean interval between like-sense zero crossings for a stationary, differentiable Gaussian process; it is not an identity for a short deterministic record.

Derivation: coefficients, one-sided normalization and Parseval

Xk = Σn=0N−1 wn(ηn − η̄) exp(−i2πkn/M)

fk = k/(MΔt),   U = (1/N)Σwn²

Ŝk = ck Δt |Xk|²/(NU)

Σk=0M/2Ŝk/(MΔt) = Σwn²(ηn−η̄)²/(NU)

Here ck = 2 for interior positive frequencies, and 1 at DC and Nyquist. N counts observed samples; M = 16,384 includes appended zeros. Rectangular weights are w = 1; the symmetric Hann taper is wn = [1 − cos(2πn/(N−1))]/2. Dividing by U corrects the taper's mean-square gain. For a rectangular window, the integral equals the demeaned sample variance with divisor N. For Hann it equals the window-weighted mean square divided by U, which need not equal the unweighted variance of this particular record. Mean removal before tapering does not guarantee zero DC after tapering.

For an unpadded rectangular DFT and an isolated, bin-centred sinusoid, a = 2|Xk|/N and φ = arg(Xk). Off-bin components, overlapping leakage and tapering require more care. A coefficient at a nearby padded bin is therefore not labelled as an exactly recovered physical component. All FFT-integral checks include the entire 0–10 Hz band; the figure zooms to 0.06–0.22 Hz.

Derivation: spectral moments and the illustrative bins

mn = ∫₀∞ fnS(f) df ≈ Σ fknSkΔf

Known discrete lines: mn = Σ finai²/2

Hm0 = 4√m₀;   Tm01 = m₀/m₁;   Tm02 = √(m₀/m₂)

The moment readouts use the exact line frequencies. The coloured 0.010 Hz rectangles are an area-preserving illustration, not an inferred bandwidth or an FFT grid. Integrating f² over a genuinely flat rectangle would add vΔf²/12 to its second moment; that artificial broadening is deliberately excluded. Period guides are placed at 1/T on the frequency axis and are not extra spectral peaks.

What can a finite record tell us?

Sampling and aliasing

At Δt = 0.05 s, the sampling frequency is 20 Hz and the Nyquist frequency is 10 Hz. Frequencies above Nyquist can masquerade as lower ones: a 19.9 Hz cosine sampled at 20 Hz has the same samples as a 0.1 Hz cosine of the same phase when that phase is zero. An analogue anti-alias filter must suppress unwanted high frequencies before sampling; an FFT cannot undo this ambiguity.

Duration and leakage

A 150 s observation has nominal Fourier spacing 1/150 ≈ 0.006667 Hz. A component that does not complete an integer number of cycles spreads across Fourier bins. Even a bin-centred sinusoid has sidelobes between those bins, visible on a zero-padded plot. Longer records narrow the spectral response, provided the sea state remains sufficiently stationary.

Windows and zero-padding

A Hann taper reduces the influence of the record's ends. It suppresses distant sidelobes but broadens the main peak, trading separation of nearby frequencies for reduced leakage. Appending zeros gives a finer plotting interval, here 20/16,384 ≈ 0.001221 Hz. It interpolates the same finite-record transform and creates no new observations or resolving power.

Uncertainty and changing seas

A raw periodogram of a random sea is a noisy estimate, even when the transform is exact. Averaging spectra from segments reduces sampling variability but sacrifices frequency resolution. Longer records can mix changing conditions, so duration, averaging and stationarity must be considered together. This five-component experiment demonstrates analysis errors and finite-record effects; it is not a stochastic confidence-interval model.

Experiment: does phase change a component's variance?

Add B, select it and change its phase to 180°. The record changes and the known variance bars stay fixed. Finite-record cross terms can change the estimated periodogram. For A and B alone over the default 150 s, both complete integer cycles, so their rectangular-window integrated variance remains 0.20250 m².

Experiment: where does leakage go when the record gets longer?

Add all five components and compare 150 s with 300 s. The nominal spacing halves, but not every component becomes bin-centred. Change to Hann and observe lower distant sidelobes with broader peaks. The reference moments do not change because the component amplitudes and frequencies have not changed.

Two lenses on the same motion.

Time domain: a zero-upcrossing analysis separates the record into individual waves. Each complete wave has a crest-to-trough height and a period. H1/3 is the average height of the highest third of those complete waves (top third rounded up for this short exercise).

Frequency domain: a variance-density spectrum describes how surface-elevation variance is distributed over frequency. The integral under S(f) is m₀, with units m². The widely used spectral significant wave height is Hm0 = 4√m₀.

Different period summaries: Tp is the inverse of the frequency at the largest spectral bin; Tm01 and Tm02 weight the whole spectrum, so they respond to changing frequency composition. Equal strongest bins produce a peak-frequency tie; this demonstration reports the lowest tied frequency.

Hm0 and H1/3 are not interchangeable identities. The former is derived from variance and commonly relates to significant heights under random-sea assumptions; the latter is a direct sample statistic. In a narrow-band linear Gaussian sea, the Rayleigh approximation brings the two close; breaking, nonlinearity and finite samples can change that relationship. Their difference is particularly clear for a single deterministic sinusoid, whose H1/3 is exactly 2a while Hm0 = 4a/√2.

Questions to test the model

  1. Start with A. Why is Hm0 larger than its single-wave height 2a?
  2. Add B. Which quantities increase, and why do we now have two equally high frequency bars?
  3. Add all five. Why do Tm01 and Tm02 respond even though the strongest frequency bin has not changed?

Go deeper: from bins to moments

How is a harmonic's variance converted into spectral density?
vi=ai22,Si=viΔf

A sinusoid with amplitude ai has variance vi = ai²/2 in m² (averaged over complete cycles). A hypothetical flat bin of width Δf = 0.010 Hz has density Si = vi/Δf in m²/Hz. Changing a bin width changes the density height but not its area or variance.

The model sums exact known harmonic contributions. Computing a spectrum from an observed record instead requires frequency analysis, finite-record treatment and averaging. The chosen 0.010 Hz bins should not be mistaken for the resolution or output of an FFT of this trace.

Why do we integrate spectral moments?
mn=∫0∞fnS(f)df≈∑finviHm0=4m0,Tm01=m0m1,Tm02=m0m2

m0 is total elevation variance. m1 and m2 shift the weighting toward higher frequencies. Here the exact discrete-harmonic expression Σfinvi supplies each moment. Tp = 1/fp is reported separately. These are frequency-based, not angular-frequency-based, moments.

Why can a short record disagree with spectral Hm0?

Because the fixed-phase five-wave record is deterministic and finite. Its beginning and ending waves may be incomplete, its measured heights depend on the phase pattern, and the prescribed harmonic variances represent component-wise long-time contributions rather than a finite-record variance estimator. The usual near-equivalence between Hm0 and significant individual-wave heights is a statistical approximation under appropriate random-sea conditions, not a mathematical identity.