How can I save a plot made using pwelch (power spectral density) command
Show older comments
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!
Answers (1)
Walter Roberson
on 26 Aug 2015
[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');
Categories
Find more on 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!