Application notes
Spectrum scaling
Definition
Samples normalized to complex full scale, x = (I + jQ) / 32768. Spectrum m of NFFT samples with window w[n]:
P_m[k] = 20·log10( |Σ_n w[n] · x[m·N_FFT + n] · exp(−j2π·k·n / N_FFT)| / Σ_n w[n] ) [dBFS]
| Signal | Reading |
|---|---|
| Complex tone of amplitude A, centred in a bin | 20·log10(A) dBFS, for any NFFT and any window |
| Full-scale tone | 0 dBFS |
| White noise of total power σ² | σ² · ENBW / NFFT per bin |
Noise
Equivalent noise bandwidth in bins: ENBW = NFFT · Σw² / (Σw)².
noise per bin = σ² · ENBW / N_FFT
noise density = noise per bin / (ENBW · f_s / N_FFT)
| Quantity, Hann window, fs = 125 MS/s | NFFT = 1024 | NFFT = 65 536 |
|---|---|---|
| Noise per bin below σ² | 28.3 dB | 46.4 dB |
| Noise density below the noise per bin | 52.6 dB | 34.6 dB |
| Measured noise floor per bin | about −95 dBFS | about −113 dBFS |
- Doubling NFFT lowers the noise per bin by 3 dB; tones keep their level.
- Measured noise density of the receiver: about −147.6 dBFS/Hz.
FFT length
| NFFT | Bin spacing | Length of one spectrum | Spectra in 221 samples |
|---|---|---|---|
| 256 | 488 kHz | 2.05 µs | 8192 |
| 1024 | 122 kHz | 8.19 µs | 2048 |
| 4096 | 30.5 kHz | 32.8 µs | 512 |
| 16 384 | 7.63 kHz | 131 µs | 128 |
Window
| Window | ENBW | Highest sidelobe | Loss for a tone between two bins |
|---|---|---|---|
| Hann | 1.5 bins | −31.5 dB | up to 1.42 dB |
| Blackman–Harris, 4-term | 2.0 bins | below −92 dB |
Use the Blackman–Harris window next to strong tones, where more than about 90 dB of dynamic range is needed. The division by Σw keeps the calibration for any window.
Overlap
Without overlap the window gives little weight to the samples at the block edges: a pulse much shorter than a block reads low when it falls on a boundary. With a hop of NFFT/2 the shifted Hann windows add up to a constant and every sample counts equally:
idx = (1:nfft)' + (0:2*M-2) * nfft/2; % blocks overlapping by half
S = fftshift(fft(x(idx) .* w), 1) / sum(w);
t = (0:2*M-2) * nfft/2 / fs * 1e3; % [ms]
Reference implementation
M = floor(N / nfft); % number of spectra
w = 0.5 - 0.5 * cos(2*pi*(0:nfft-1)' / nfft); % Hann window
S = fftshift(fft(reshape(x(1:M*nfft), nfft, M) .* w), 1) / sum(w);
P = 20 * log10(abs(S) + 1e-12); % dBFS
f_if = (f_nco + (-nfft/2:nfft/2-1) * fs / nfft) / 1e6; % [MHz]
t = (0:M-1) * nfft / fs * 1e3; % [ms]
RX A with the 4R2C-2G5 front-end, NFFT = 1024, Hann window, no overlap. Bluetooth Low Energy advertising packets at −50, −46 and −41 dBFS; noise floor about −95 dBFS per bin. The signal labels were added for the figure.