Logarithmic scale using PSD function
6 次查看(过去 30 天)
显示 更早的评论
I have a problem using the PSD function - basically the output of my code gives the frequency in a linear scale, when i need it in a logarithmic scale. Does anyone know how to alter the PSD/output to give the resulting plot in a logarithmic scale? cl is an array of values. I assume it is something very basic i need to change.
My code is as follows:
Fs = 1/0.005;
h = spectrum.welch;
Hpsd = psd(h,cl,'Fs',Fs);
plot(Hpsd)
0 个评论
采纳的回答
Patrick Kalita
2011-3-3
After creating the plot, set the axes XScale (if you want to replicate a semilogx plot) property to 'log'. For example:
Fs = 1000; t = 0:1/Fs:.296;
x = cos(2*pi*t*200)+randn(size(t));
h = spectrum.welch; % Create a Welch spectral estimator.
Hpsd = psd(h,x,'Fs',Fs); % Calculate the PSD
plot(Hpsd)
set(gca, 'XScale', 'log')
更多回答(2 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Estimation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!