Documentation chapters

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]
SignalReading
Complex tone of amplitude A, centred in a bin20·log10(A) dBFS, for any NFFT and any window
Full-scale tone0 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/sNFFT = 1024NFFT = 65 536
Noise per bin below σ²28.3 dB46.4 dB
Noise density below the noise per bin52.6 dB34.6 dB
Measured noise floor per binabout −95 dBFSabout −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

NFFTBin spacingLength of one spectrumSpectra in 221 samples
256488 kHz2.05 µs8192
1024122 kHz8.19 µs2048
409630.5 kHz32.8 µs512
16 3847.63 kHz131 µs128

Window

WindowENBWHighest sidelobeLoss for a tone between two bins
Hann1.5 bins−31.5 dBup to 1.42 dB
Blackman–Harris, 4-term2.0 binsbelow −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]
Spectrogram of RX A from 2388 to 2512 MHz over 16.8 ms, 1024-point Hann FFT, colour scale in dBFS

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.