Prev
Unit 6 · Lesson 6-3
Spectral Leakage and Windows
1h 45m1300 XP
Next

Spectral Leakage and Windows

Why off-bin tones leak, the rectangular window's transform, Hann, Hamming, Blackman and Kaiser windows, zero padding and Welch's method

1978 — a paper about windows
In January 1978 the Proceedings of the IEEE prints a long paper with a modest title: "On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform". Its author, fredric harris of San Diego State University — he prefers his name in lower case — compares a long list of windows by the same handful of measures. It becomes his most famous paper; he is also a co-inventor of the Blackman–Harris window (Fredric J. Harris). The problem it addresses is everywhere. Record a pure tone and take its DFT: unless the record holds a whole number of cycles, the tone does not appear in one bin but leaks into all of them, and a faint tone nearby can drown in the leakage. A window — a taper applied to the record before the transform — trades one kind of blur for another.
Derivation
Where leakage comes from
An NN-sample record of ejΩ0ne^{j\Omega_0 n} is the endless tone multiplied by a rectangle. Its DTFT is the rectangle's transform, the Dirichlet kernel, centred on Ω0\Omega_0:
X(ejΩ)=e−j(Ω−Ω0)(N−1)/2 sin⁡(N(Ω−Ω0)/2)sin⁡((Ω−Ω0)/2).X(e^{j\Omega}) = e^{-j(\Omega - \Omega_0)(N-1)/2}\,\frac{\sin\big(N(\Omega - \Omega_0)/2\big)}{\sin\big((\Omega - \Omega_0)/2\big)} .
The DFT samples it at the bins Ωk=2πk/N\Omega_k = 2\pi k/N. If Ω0\Omega_0 is itself a bin — a whole number of cycles in the record — every other sample lands on a zero of the kernel, and the spectrum shows one clean line. Otherwise the samples catch the kernel's side lobes. Halfway between bins the peak drops by a factor 2/π2/\pi (−3.92 dB), and 19 % of the energy escapes the two nearest bins.
💡Windows
Multiply the record by a taper w[n]w[n] that falls smoothly to zero at both ends. Multiplication in time is convolution in frequency (Lesson 4-2), so the window's transform replaces the Dirichlet kernel: lower side lobes, wider main lobe. Measured for 64-point windows in this lesson's lab: | Window | Main lobe (bins) | Highest side lobe | Worst-case loss | |---|---|---|---| | Rectangular | 2 | −13.3 dB | 3.92 dB | | Hann | 4 | −31.5 dB | 1.42 dB | | Hamming | 4 | −42.4 dB | 1.75 dB | | Blackman | 6 | −58.1 dB | 1.10 dB | | Kaiser, β = 8.6 | 5.8 | −63.4 dB | 1.11 dB | Hann is 12−12cos⁡(2πn/N)\tfrac12 - \tfrac12\cos(2\pi n/N); Hamming adjusts the two weights to 0.54 and 0.46; Blackman adds a third cosine; Kaiser has a parameter β\beta that slides continuously between narrow main lobes and low side lobes.
📐A faint tone beside a loud one
A strong tone sits exactly between two bins, and a tone 60 dB weaker — a thousandth of its amplitude — sits 100 Hz, about 13 bins, above it. With the rectangular window the strong tone's leakage at the weak tone's bins is −30.9 dB, and the weak tone at −60 dB is invisible. A Hann window leaves only −73.5 dB of leakage there, a Blackman window −81.2 dB, and the weak tone stands clear of it.
💡Resolution and zero padding
Two tones can be told apart only if they are farther apart than about one main-lobe half-width — roughly 1/T1/T hertz for a record of duration TT, wider for tapered windows. Zero padding appends zeros before the DFT: it samples the same DTFT more finely, giving a smoother curve and better peak positions, but it adds no information and cannot separate tones that the record's length cannot.
Noise and Welch's method. For a noisy record, the periodogram ∣X[k]∣2/N|X[k]|^2/N fluctuates wildly from bin to bin — for white noise its scatter is about 5.6 dB however long the record. Peter Welch's method (1967) cuts the record into overlapping segments, windows each one, and averages their periodograms: the scatter falls roughly as 1/K1/\sqrt{K} for KK segments, at the cost of the wider bins of a short segment. In this lesson's lab, 20 seconds of data averaged in 1024-sample segments bring the scatter from 5.6 dB to 0.8 dB, while the bins widen from 0.05 Hz to 0.98 Hz.
The purpose of computing is insight, not numbers.
– Richard Hamming, Numerical Methods for Scientists and Engineers (1962), preface, quoted on Wikiquote
🕰A not very serious proposal
The window everyone calls "Blackman" is what Ralph Blackman himself described as a "not very serious proposal". The Hamming window chooses its weight of about 0.54 so as to cancel the first side lobe of the Hann window, leaving one about a fifth as high (Window function).
⚠Windows change the numbers
A window removes part of the signal's energy. To read a tone's amplitude, divide by the window's sum ∑w[n]\sum w[n] — the Hann window's average is one half — and to read noise power, divide by ∑w[n]2\sum w[n]^2. Forgetting this makes every windowed spectrum several decibels too low, differently for tones and for noise.
💡Where you will use this
Every spectrum analyser offers a choice of windows, and vibration, acoustic and radio measurements depend on choosing well. The same windows design FIR filters (Lesson 9-1), and each column of a spectrogram (Lesson 6-4) is a windowed DFT.
📚Further reading
  • fredric j. harris, "On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform", Proceedings of the IEEE 66 (1978), 51–83.
  • Peter D. Welch, "The Use of Fast Fourier Transform for the Estimation of Power Spectra", IEEE Transactions on Audio and Electroacoustics 15 (1967), 70–73.
  • Window function on Wikipedia — formulas and plots for dozens of windows.
↓But there is a problem
A spectrum tells you which frequencies a recording contains — but not when. A bird's chirp, a radar sweep and a spoken word all have spectra that hide the order of events. In September 2015, two detectors 3002 kilometres apart recorded a signal that lasted a fifth of a second and rose in pitch from 35 to 250 Hz. Its spectrum alone would never have said what it was.