FFT Spectrum Analyser
Compose a test signal and read its FFT spectrum, THD, SFDR, SNR, SINAD and ENOB.
Free to use. Sign up free to save, download and print.
Worked example: a 1025 Hz tone half a bin off
Tone level: 0.00 dBFS
Loading the FFT Spectrum Analyser…
How it works
FFT frequency resolution and window correction
An FFT of N samples taken at a sample rate fs splits the spectrum into bins fs/N wide, so the frequency resolution is the sample rate divided by the FFT length, or one over the length of the record. The analyser computes the spectrum of a signal you compose from tones, waves and noise, not of a signal captured from hardware.
A window tapers the record to cut leakage, but it scales every reading by its coherent gain, spreads each tone over a main lobe several bins wide, and makes a tone between two bins read low in its peak bin, which is called scalloping loss. The analyser divides out the coherent gain, and reads each tone's level from the power over its main lobe divided by the window's noise equivalent bandwidth, so the level is right wherever the tone falls. SNR and SINAD compare that tone power with the noise, read the same way, and SFDR compares that tone power with the largest other component, read the same way over its own main lobe.
A tone between bins also spreads the window's own sidelobes across the spectrum. Those are not spurs in the signal, but they can be the largest thing left: a clean tone half a bin off reads about 32 dB of SFDR through a Hann window and about 18 dB with no window. Converter test software deals with this by leaving a set number of bins either side of the tone, and above DC, out of the spur search and the noise, and the analyser does the same. When the window's leakage from the tone could still make up half or more of the bin that sets SFDR, or of the noise behind SNR and SINAD, the analyser says so. Putting the tone on a bin, which is coherent sampling, removes the leakage for every window here but Kaiser: it is not a sum of cosines, so it leaks a little even on a bin. A window with lower sidelobes also helps.
A two-tone test puts two tones of equal level, f₁ and f₂, through the device, and the third-order products at 2f₁ − f₂ and 2f₂ − f₁ fall close to them. The usual convention gives these products, and the two-tone SFDR, relative to either tone, not to the two together. When two or more components are the wanted tones, the analyser reads each as signal, with its own ignored bins, and gives every figure against the weaker tone. The noise leaves out the tones, their harmonics and every second- and third-order product, and SINAD adds those products back. THD and ENOB are single-tone measures and are not given. No intercept point is given either: a converter's products do not rise 3 dB for each dB of input as an amplifier's do, and a composed signal has no device to hold one.
Δf = fs / N
X[k] = Σ w[n] x[n] e^(−j2πkn/N), for n = 0 to N − 1
Aₖ = 2 |X[k]| / (N × CG), with CG = Σ w[n] / N
NEBW = N Σ w[n]² / (Σ w[n])²
A² = (Σ Aₖ² − the noise in those bins) / NEBW, over the tone's main lobe
SNR = 10 log₁₀(A² / Pₙ), with Pₙ = (N/2) p̄ / NEBW
SINAD = 10 log₁₀(A² / (Pₙ + P_H))
SFDR = 10 log₁₀(A² / A_spur²), in dBc
IMD3 = 10 log₁₀(A² / A_IM3²), in dBc per tone, the worse of 2f₁ − f₂ and 2f₂ − f₁
- fs
- sample rate, in Hz
- N
- FFT length, in samples, a power of two for the radix-2 FFT
- Δf
- bin width, the frequency resolution, in Hz
- x[n], w[n]
- the signal samples, in full-scale units, and the window
- X[k], Aₖ
- FFT output in bin k, and its one-sided amplitude in full-scale units (not doubled at DC and Nyquist)
- CG
- coherent gain of the window, the mean of w[n]
- NEBW
- noise equivalent bandwidth of the window, in bins
- A
- amplitude of the tone; 20 log₁₀ A is its level in dBFS. In a two-tone or multi-tone test, the amplitude of the weaker tone
- p̄, Pₙ
- mean Aₖ² of the bins outside the tone and harmonic bands and the bins left out either side of the tone and above DC, leaving out DC, and the noise power, that mean over every bin from 1 to N/2; a spur that is not a harmonic counts as noise
- P_H
- power of the harmonics, from the second up to the number chosen, each read like the tone
- A_spur
- amplitude of the largest component outside the tone's main lobe and the bins left out either side of the tone and above DC, harmonics included, read like the tone over the bins of its own main lobe that no tone or harmonic band holds, and never below its highest single bin. In a two-tone or multi-tone test, outside every tone, with intermodulation products included
- f₁, f₂
- the two tone frequencies, in Hz, f₁ the lower
- A_IM3
- amplitude at a third-order product, 2f₁ − f₂ or 2f₂ − f₁, read like a harmonic over its main lobe and never below its highest single bin
Worked example
Worked example: a 1025 Hz tone half a bin off
A full-scale 1025 Hz sine sampled at 51.2 kS/s, analysed with a 1024-point FFT and a Hann (Hanning) window, with no noise added.
| Step | Working | Result |
|---|---|---|
| Bin width | 51200 / 1024 | 50 Hz |
| Tone position | 1025 / 50 | bin 20.5 |
| Hann window | mean of w[n], and N Σ w[n]² / (Σ w[n])² | CG 0.50, NEBW 1.50 bins |
| Peak bin | 2 |X[k]| / (N × 0.50) | −1.42 dBFS |
| Tone level | 10 log₁₀(Σ Aₖ² / 1.50) | 0.00 dBFS |
On a bin centre, as at 1000 Hz in bin 20, the peak bin reads 0.00 dBFS as well. Half a bin off is the worst case, and a window's response there is its scalloping loss: 1.42 dB for Hann and 3.92 dB for a rectangular window, which is why the analyser takes a tone's level from its main lobe power rather than its peak bin. A 2048-point FFT halves the bin width to 25 Hz, with a 40 ms record in place of 20 ms.
FAQ
Frequently asked questions
Not here? Ask us
Calculations run in your browser and nothing you enter is sent to a server.
How do I calculate FFT frequency resolution?
Divide the sample rate by the FFT length: Δf = fs / N, which is also one over the record length. At 51.2 kS/s, a 1024-point FFT has 50 Hz bins and a 20 ms record. A window also widens each tone into a main lobe, 4 bins from null to null for Hann and 2 for a rectangular window, so the main lobe, not the bin width alone, sets how close two tones can be and still be seen apart. The analyser uses a radix-2 FFT, so N is a power of two.
Why does the choice of window matter?
A finite block of signal has abrupt edges that spread energy across many bins, which is called spectral leakage. A window tapers the edges to reduce leakage at the cost of a wider mainlobe. Rectangular gives the narrowest mainlobe but high sidelobes, Blackman-Harris gives very low sidelobes, and flat top gives the most accurate amplitude for a single tone. The right choice depends on what you are measuring.
What is coherent gain correction?
Every window reduces the measured amplitude of a tone by its coherent gain. Without correction, a tone would read low by that factor. The analyser corrects the amplitude spectrum for coherent gain, and corrects power spectral density for the window's noise equivalent bandwidth, so readings are consistent whichever window you choose.
How is THD calculated?
THD is the square root of the sum of the harmonic powers divided by the fundamental power. Each harmonic's power is summed over its main lobe, less the noise expected there, from the second harmonic up to the number of harmonics you choose, and THD is reported in per cent.
What is ENOB?
Effective number of bits is the resolution of an ideal converter that would give the same SINAD as the signal under test. It is calculated as SINAD minus 1.76 dB, divided by 6.02 dB per bit. Any distortion or noise above the quantisation floor reduces ENOB below the nominal bit count.
How is two-tone IMD3 reported?
As the level of the third-order products at 2f₁ − f₂ and 2f₂ − f₁ in dBc relative to one tone, not to the two tones together, the usual convention for converters. Each of two equal tones is set a little over 6 dB below full scale so their peaks do not clip when they add in phase. The two-tone SFDR is the gap from one tone to the largest other component, which may or may not be an intermodulation product. With unequal tones the analyser refers every figure to the weaker one.
How is this different from a hardware spectrum analyser?
A hardware analyser measures real signals from a circuit or off air. This analyser computes the spectrum of a signal you compose, using the same mathematics. It suits test signal analysis, teaching and FFT verification, while a real RF signal still needs a hardware instrument.
Sign up free to keep your work.
Free to use. Saving, downloading and printing need a free account.