FFT Basics
Fast Fourier Transform fundamentals — bins, leakage, windows, and common pitfalls.
Reference
Key relationships
- Bin frequency
- f_k = k · (f_s / N) — k ∈ [0, N/2]
- Bin resolution
- Δf = f_s / N (Hz per bin)
- Nyquist
- f_max unambiguous = f_s / 2
- Zero-padding
- Interpolates between bins — does NOT add new frequency info
- Window sum
- Multiplies the amplitude — normalize by its coherent gain
Common window functions
| Window | Main lobe width | Side-lobe level | Use |
|---|---|---|---|
| Rectangular (none) | 2 bins | −13 dB | Transient / narrow spectra |
| Hann | 4 bins | −31 dB | General purpose |
| Hamming | 4 bins | −42 dB | General, lower side-lobes |
| Blackman | 6 bins | −58 dB | Further side-lobe suppression |
| Blackman–Harris | 8 bins | −92 dB | When dynamic range matters |
| Flat-top | 5+ bins | −70 dB | Amplitude accuracy for tonal sig |
| Kaiser (β tunable) | variable | variable | Tunable 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).
Last updated: