why psd result estimated by fft is related to frequency resolution?

3 views (last 30 days)
Here is the code from MATLAB help center.(https://www.mathworks.com/help/signal/ug/power-spectral-density-estimates-using-fft.html)
I only change one parameter T(total time) in the code, when i change T from 1,10,100 to 1000, the final result also change about 10 db/hz. But i don't understand why and how to explain that. will the frequency resolution Fs/n influence the final result?
thanks for your answer! really appreciate it !
rng default
Fs = 1000;
T=1;
t = 0:1/Fs:T-1/Fs;
x = cos(2*pi*100*t) + randn(size(t));
N = length(x);
xdft = fft(x);
xdft = xdft(1:N/2+1);
psdx = (1/(Fs*N)) * abs(xdft).^2;
psdx(2:end-1) = 2*psdx(2:end-1);
freq = 0:Fs/N:Fs/2;
plot(freq,10*log10(psdx))
grid on
title('Periodogram Using FFT')
xlabel('Frequency (Hz)')
ylabel('Power/Frequency (dB/Hz)')

Answers (1)

Raunak Gupta
Raunak Gupta on 2 Oct 2020
Hi,
The power spectral density estimate shown in each T=1,10,100,1000 is correct as it shows a peak around 100 Hz which exactly represent the frequency present in the signal. Since you are changing T, the length of signal x is changing, and the random noise is getting added which is of different size (If we have different T).
If I see the difference between two values of T it is more towards the –50 to –40 dB side which is very small amplitude value for any signal. This is mainly coming due to small noise variations. If you remove the noise term [randn(size(t))] you will not see any difference between T=1 or T=100.
Also note that we ignore Power/Frequency which is very low (in range of –60 to 70dB/Hz or even lower).
Hope this clarifies!
  2 Comments
Ziying Huang
Ziying Huang on 5 Oct 2020
If I remove the noise, the result of PSD is still changing. When T is 1, the amplitude of 100Hz is -3db/Hz. When T is 10, the amplitude of 100Hz is 6db/hz. i think the number make much difference and it cannot be neglected.
thanks again for your answer! But i'm still confused.
Raunak Gupta
Raunak Gupta on 5 Oct 2020
Hi,
I agree the peak value is changing exactly as you say, that is because the length of signal is changing and since it is periodic signal, power spectral density is scaled up with respect to number of points.
You may refer to the blogs related to fft which nicely mentions the logic behind it.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!