PSD question
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
What are the units of the Y axis of this code? I think it's dB/Hz but I'm not sure.
fs=2000;
Hs=spectrum.periodogram; % Use default values
psdest = psd(Hs,Signal,'Fs',fs);
semilogx(psdest.Frequencies,10*log10(psdest.Data));
grid on;
0 Kommentare
Akzeptierte Antwort
Wayne King
am 1 Nov. 2011
Yes, it is dB/Hz.
psdest.Data are the power estimate, proportional to magnitude-squared of the DFT. So 10*log10() is in dB
0 Kommentare
Weitere Antworten (1)
Wayne King
am 1 Nov. 2011
Hi, below I provide an example using just the DFT and then applying the proper scaling and the spectrum.periodogram object, so you can see how to do it the "brute force" way.
dt=1/10000;
t=0:dt:.1024-dt; %time vector of length 1024
y=cos(2*pi*1000*t)+randn(size(t));
h=spectrum.periodogram; %spectrum object (periodogram)
psd_est_1side=psd(h,y,'spectrumtype','onesided','Fs',10000);
y_fft=abs(fft(y)).^2;
Y_fft=y_fft(1:513); % we only keep the positive frequencies.
Y_fft=(dt/1024)*Y_fft;
Y_fft(2:end-1)=2*Y_fft(2:end-1);
%compare
plot(psd_est_1side.Frequencies./1000,10*log10(Y_fft));
xlabel('kHz'); ylabel('Power/Hz (dB)'); grid on;
figure;
plot(psd_est_1side);
0 Kommentare
Siehe auch
Kategorien
Mehr zu Parametric Spectral Estimation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!