Electronics

FFT Basics

Fast Fourier Transform fundamentals — bins, leakage, windows, and common pitfalls.

Key relationships

Bin frequencyf_k = k · (f_s / N) — k ∈ [0, N/2]
Bin resolutionΔf = f_s / N (Hz per bin)
Nyquistf_max unambiguous = f_s / 2
Zero-paddingInterpolates between bins — does NOT add new frequency info
Window sumMultiplies the amplitude — normalize by its coherent gain

Common window functions

WindowMain lobe widthSide-lobe levelUse
Rectangular (none)2 bins−13 dBTransient / narrow spectra
Hann4 bins−31 dBGeneral purpose
Hamming4 bins−42 dBGeneral, lower side-lobes
Blackman6 bins−58 dBFurther side-lobe suppression
Blackman–Harris8 bins−92 dBWhen dynamic range matters
Flat-top5+ bins−70 dBAmplitude accuracy for tonal sig
Kaiser (β tunable)variablevariableTunable trade-off

Gotchas

  • Spectral leakage: non-integer-period signals smear across bins — use a window.
  • Picket-fence: a tone between bins reads low in amplitude — use flat-top or interpolate.
  • Aliasing: frequencies above f_s/2 fold back — anti-alias filter before sampling.
  • Inverse FFT: size must match forward. Scale by 1/N depending on library convention.
  • Real input: FFT output is symmetric — only need N/2 + 1 bins (rfft).
Was this article helpful?