"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
Best Answer