MATLAB: Suggestions for quantifying spectral leakage

fftspectral leakage

Hi,
I'm thinking about how I can quantify spectral leakage for a sinusoid of known frequency, say 1MHz for example.
I initially thought about taking the FFT, and seeing what percentage of the signal's energy is not in the 1MHz bin. But then I realised this wouldn't work as if there was a 1MHz bin, there wouldn't be any spectral leakage.
Any suggestions?
Thanks.

Best Answer

"But then I realised this wouldn't work as if there was a 1MHz bin, there wouldn't be any spectral leakage."
The above statement is not correct. The spacing of the DFT bins is determined by the number of samples and the sampling frequency.
Leakage is a result of the convolution of the signal's spectrum with that of the window -- they are separate things.
For example:
Fs = 4e6;
t = 0:1/Fs:0.2-1/Fs;
x = cos(2*pi*1e6*t);
xdft = fft(x'.*hamming(length(t)));
fundbin = (1e6/5)+1;
xdft([fundbin-4:fundbin+4])
The frequency spacing is 5 Hz, you see that there is power not only at 1 MHz, but also at +/- 5 Hz
Related Question