How can I save a plot made using pwelch (power spectral density) command

7 次查看(过去 30 天)
So, I'm using this command to generate a power spectral density plot:
pwelch(a(1:1843200),hanning(1024*8),0,1024*8,512);
but this returns a window and I was wondering if I could write another line of code which is going to save this image automatically.
Furthermore, when I set
X= pwelch(a(1:1843200),hanning(1024*8),0,1024*8,512);
and do plot(x) it does not give me the plot with power and frequency on the axis. Is there a way of solving that?
Any help will be appreciated guys!

回答(1 个)

Walter Roberson
Walter Roberson 2015-8-26
[X, f] = pwelch(a(1:1843200),hanning(1024*8),0,1024*8,512);
plot(f, 10*log10(X));
xlabel('Frequency (Hz)')
ylabel('Magnitude (dB)')
saveas(gcf, 'MyPwelch.jpg');

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by