PSD question
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Wayne King
2011-11-1
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 个评论
更多回答(1 个)
Wayne King
2011-11-1
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!