Is the DFT or PSD length dependent?
1 view (last 30 days)
Show older comments
Is the DFT amplitude dependent on the length of the time signal being analyzed?
Do I need to know the length and sampling rate of the data a PSD was calculated from to back out the DFT amplitude? How are the PSD and DFT related?
Example:
tiledlayout(3,1)
sp(3) = nexttile;
sp(1) = nexttile;
sp(2) = nexttile;
hold(sp,"on")
c=1;
for n=5:-1:3
N = 10^n;
dt = 1e-3;
Fs = 1/dt;
T = dt*N;
t = (0:dt:T-dt);
x = rand(N,1);
x=x-mean(x);
[pxx,f]=periodogram(x,[],[],Fs);
plot(sp(1),f,20*log10(pxx))
Y = fft(x);
P2 = abs(Y/N);
P1 = P2(1:N/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(N/2))/N;
plot(sp(2),f,10*log10(P1))
plot(sp(3),t,x)
legTag{c}=[num2str(N),' Point Signal'];
c=c+1;
end
ylim(sp(3),[-1,1])
ylabel(sp(1),'Power Density [dB/Hz]')
ylabel(sp(2),'Amplitude [dB]')
ylabel(sp(3),'Amplitude [G]')
xlabel(sp(1:2),'[Hz]')
xlabel(sp(3),'[sec]')
title(sp(3),'Time Series : rand(N_{legend}) : dt = 1e-3s')
title(sp(1),'PSD via Periodogram')
title(sp(2),'DFT via fft')
legend(sp(1),legTag)
legend(sp(2),legTag)
legend(sp(3),legTag)
0 Comments
Answers (1)
Alex Batts
on 4 May 2023
Edited: Alex Batts
on 4 May 2023
I'm not exactly sure all of what you are trying to ask, but I'll briefly explain the difference between the FFT (DFT) and the PSD.
The PSD is the fourier transform of a signal's autocorrelation function (or in discrete world, autocorrelation sequence). It gives an estimate of the power of the frequency content contained in the signal. You can estimate the PSD of a signal from the DFT by:
Y = fft(x); % Calculate the FFT
Py = abs(Y).^2/length(Y); % Estimate the PSD
Py2 = Y.*conj(Y)/length(Y); % Alternate way to estimate the PSD
Now, I'm not sure what you are trying to do by finding the amplitude of the DFT from the PSD. If you are looking for only the amplitude, I suppose you could estimate the amplitude by:
Y_est = sqrt(Py*length(Y)); % Estimate of the FFT amplitude
However, the PSD is a real valued function, whereas, generally speaking, the DFT is a complex valued function. There is no way to extract a complex valued DFT from a PSD since the complex magnitude is non-linear. Since there is no phase information, there is no way to go back to the complex-valued DFT from a PSD.
0 Comments
See Also
Categories
Find more on Parametric Spectral Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!