S729 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S7 · Lesson 29 · Spectral analysis with windows

The DFT of a windowed sinusoid, leakage and scalloping, resolution, zero padding, coherent gain and equivalent noise bandwidth, and reading amplitudes off a spectrum

Point an FFT at a signal and it returns numbers that look like a spectrum, but they're the spectrum of a finite, windowed piece of the signal, sampled at N frequencies. A tone that doesn't fall exactly on a bin smears across many of them, a strong tone's sidelobes can bury a weak one nearby, and the peak reads up to 4 dB low depending on where the tone happens to sit. Every spectrum analyzer and every FFT plot is shaped by these effects. This lesson quantifies them so the numbers an FFT gives can be read as measurements, with known errors.

  • The 32-point DFT magnitudes (stems, in dB) of a tone at bin 8 + d, with a rectangular window and with a Hann window (positive-frequency component, normalized to each window's on-bin peak).
  • With d = 0 the rectangular window shows one clean bin, but move the tone between bins and its energy leaks across the whole spectrum, falling off slowly.
  • The Hann window always smears over three bins but its leakage dies fast. At d = 0.5 the rectangular peak drops 3.92 dB and the Hann peak only 1.42 dB: the scalloping loss.

Predict

A 1024-point FFT at 8 kHz has 7.8 Hz bins. Will zero-padding it to 8192 points let it separate two tones 4 Hz apart?

Name it

The windowed tone

A tone at bin k0+d (d the fractional offset) windowed by w[n] gives a DFT equal to the window's spectrum W centered on k0+d and sampled at the integer bins. For the rectangular window, |X[k]|∝|sin⁡π(k−k0−d)Nsin⁡(π(k−k0−d)/N)|.

  • Leakage: energy in bins far from the tone, set by the window's sidelobes.
  • Scalloping loss: the peak's drop when the tone falls between bins: 3.92 dB for the rectangle at d = ½, 1.42 dB for Hann, 0.01 dB for a flat-top window.
  • Resolution: two tones separate only if they're further apart than about the main-lobe half-width, which is 1 bin for the rectangle and 2 bins for Hann and Hamming. That's fs/N or 2fs/N in hertz: the record length T = N/f_s sets it.
  • Zero padding to M > N points samples the same spectrum at spacing fs/M: finer interpolation, no better resolution.

Reading amplitudes and noise

  • Coherent gain CG=1N∑w[n]: 1 for the rectangle, 0.5 for Hann, 0.54 for Hamming. A tone of amplitude A on a bin gives |X[k]|=AN2CG, so A=2|X[k]|N⋅CG.
  • Equivalent noise bandwidth ENBW=N∑w2(∑w)2 bins: 1 for the rectangle, 1.5 for Hann, 1.36 for Hamming, 1.73 for Blackman. Each bin collects noise from ENBW × fs/N hertz.
  • Processing gain: a tone rises above white noise by 10log⁡(N/ENBW) dB more than it does in the time domain.

Worked example

A tone falls exactly halfway between two bins. How much lower does its peak read with a rectangular and with a Hann window?

Show the solution
  1. Rectangular window. sin⁡(π/2)Nsin⁡(π/2N)≈2π=0.637 which is −3.92 dB.
  2. Hann window. G=2[0.5(0.637)+0.25(0.637)+0.25(−0.212)]=0.849 which is −1.42 dB.
  3. Why Hann loses less. Its wider main lobe is flatter on top.

Answer the peak reads 3.92 dB low with a rectangular window and 1.42 dB low with a Hann window.

Worked example

A 1024-point Hann-windowed FFT at 48 kHz shows a peak of |X| = 5,000 on a tone's bin, with white noise in the background. What's the tone's amplitude, and how much processing gain does the FFT give?

Show the solution
  1. Amplitude. A=2×50001024×0.5=19.5
  2. Processing gain. G=10log⁡(1024/1.5)=28.3dB So a tone 20 dB below the noise in the time domain shows up 8.3 dB above the noise floor in each bin.
  3. Resolution. Bins are 46.9 Hz apart, and Hann resolves tones about 94 Hz apart.

Answer the tone's amplitude is 19.5, and the FFT gives 28.3 dB of processing gain.

Worked example

A tone sits 20 dB below white noise (SNR −20 dB in the time domain). Will a 4096-point Hann-windowed FFT show it?

Show the solution
  1. Processing gain. G=10log10⁡(N/ENBW)=10log10⁡(4096/1.5)=34.4dB
  2. SNR in the bin. SNR=−20+34.4=14.4dB That's clearly visible, if the tone stays put for the whole record.
  3. Longer records. Each doubling of N adds 3 dB, which is how spectrum analyzers dig tones out from under noise.

Answer yes: the tone's bin shows an SNR of 14.4 dB.

Check

A tone sits 0.35 bin from the nearest bin of a 64-point rectangular-window DFT. How much does its peak read low?

Check

Roughly how close can two equal tones be and still be resolved by a 512-point Hann-windowed FFT at 44.1 kHz?

Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.

Check

A tone on a bin shows |X| = 1000 in a 256-point DFT with a window whose coherent gain is 0.54. What's its amplitude?

Check

A 1024-point FFT uses a window with ENBW = 1.36 bins. What processing gain does it give a tone in white noise?

Check

A 1024-point record at 8 kHz is zero-padded by a factor of 16. What's the spacing of the resulting spectrum's samples?

Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.

Check

Two tones 5 Hz apart must be resolved with a Hann window at 8 kHz. How many samples must the record have?

Check

A tone is −10 dB below white noise in the time domain and analyzed by a 4096-point FFT with a window of ENBW 1.36 bins.

(a)

What processing gain does the FFT give?

(b)

What SNR does the tone have in its bin?

Check

An N-point FFT at sample rate s with a window of ENBW E bins and coherent gain c shows a tone on a bin with |X| = X.

Step 1

What is the tone's amplitude?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why can a strong tone hide a weak one many bins away when the rectangular window is used?

Practice

Keep practicing

10 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.