# FFT magnitude as a function of frequency resolution

8 views (last 30 days)
Rob H on 27 Mar 2022
Commented: Paul on 29 Mar 2022
My learning research on FFTs has identified that (for example) with a FFT frequency resolution of 8 Hz, the scalar magnitude of the FFT spectral lines (computed as the abs() value of the complex numbers returned by the FFT function) should be higher than if a FFT frequency resolution of 4 Hz is used (twice the number of samples per FFT) on the same (IQ) sample data. I see evidence of this when using a Spectrum Analyser receiving broadcast FM signals and also in SDR software when doing the same (both when changing the RBW). But, when using the MatLab FFT function (on broadcast FM IQ data) the opposite is what I see - i.e the higher the FFT frequency resolution (lower number of samples per FFT), the lower the scalar magnitude of the FFT complex values. What I am I doing wrong / not understanding?
I discovered this when adding to my MatLab scripts to compute PSD - which, according to on-line sources, should be the FFT abs() value squared and DIVIDED by the FFT frequency resolution. However, I've found empirically that MULTIPLYING by the FFT frequency resolution is required to make the magnitudes similar for different FFT frequency resolutions. In generating this question,

Paul on 27 Mar 2022
Edited: Paul on 27 Mar 2022
Hi @Rob H,
For a question like this, it would be immensely helpful to provide some example data/code that illustrates the issue. Absent that, I'll provide an example and go from there.
Define a continuous-time function
syms t real
s = matlabFunction(triangularPulse(0,1,2,t));
Sample that signal over its non-zero interval with a sampling period of T1 = 0.2 and take the DFT
t1 = linspace(0,2,11); N1 = 11; n1 = 0:10; T1 = 0.2; F1 = 1/T1;
x1 = s(t1);
X1 = fft(x1);
Now do the same with a sampling period of T2 = 0.1.
t2 = linspace(0,2,21); N2 = 21; n2 = 0:20; T2 = 0.1; F2 = 1/T2;
x2 = s(t2);
X2 = fft(x2);
Plot the results
figure
hold on
stem(n2/numel(n2)*F2,abs(X2),'o');
stem(n1/numel(n1)*F1,abs(X1),'x');
xlabel('Hz')
legend('X2','X1') At 0 rad/sample, X2 = 2*X1 as expected. Other than that, I'm not sure how we an say there is any direct relatiionship between X1 and X2 wrt their sampling periods or sampling frequencies, the DFT samples don't even line up at the same frequencies.
However, such scaling by the sampling period (or equivalently by the inverse of the sampling frequency) would come into play if we want to use the DFT samples to estimate the CTFT of the original signal
syms w f real
S(w) = fourier(triangularPulse(0,1,2,t),t,w);
S(f) = S(2*sym(pi)*f);
figure
hold on
fplot(abs(S(f)),'k')
stem(ceil(-N2/2:(N2/2-1))/N2*F2,T2*abs(fftshift(X2)),'bo')
stem(ceil(-N1/2:(N1/2-1))/N1*F1,T1*abs(fftshift(X1)),'rx');
xlabel('Hz')
legend('S(f)','T2*X2','T1*X1') ##### 2 CommentsShowHide 1 older comment
Paul on 29 Mar 2022
Yes, I see now that my answer was not relevant to the question, which I completely misread. Sorry about that.
Can you post some code for a simple example that illustrates the effect in question, i.e., the higher the FFT frequency resolution (lower number of samples per FFT), the lower the scalar magnitude of the FFT complex values.

R2007b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!