hold all;
pwelch(data1);
pwelch(data2);
but this has two PSD with the same color, i don't know which is
which!!!
Any help is greatly appreciated!!!!
"Frank Sun" <fran...@mail.utexas.edu> wrote in message <ef53f...@webcrossing.raydaftYaTP>...
"Frank Sun" <fran...@mail.utexas.edu> wrote in message <ef53f...@webcrossing.raydaftYaTP>...
[Pxx1 F1] = pwelch(x1,[],[],[],fs);
Pxx1dB = 10*log10(Pxx1);
semilogx(F1,Pxx1dB,'r')
hold on
[Pxx2 F2] = pwelch(x2,[],[],[],fs);
Pxx2dB = 10*log10(Pxx2);
semilogx(F2,Pxx2dB)
hold off
grid on
For some reason the x-axis limits are a bit to high, so you might want to adjust the axis like:
axis([min(F2) max(F2) min(Pxx2dB) max(Pxx2dB)])
It might not be as short as one would like, but it works =)
figure;
NFFT = 2^nextpow2(length(d));
Pdd = abs(fft(d,NFFT)).^2/length(d)/Fs;
Pee = abs(fft(e,NFFT)).^2/length(e)/Fs;
PSD_d = dspdata.psd(Pdd(1:length(Pdd)/2),'Fs',Fs);
PSD_e = dspdata.psd(Pee(1:length(Pee)/2),'Fs',Fs);
hold on
h1 = plot(PSD_d);
set(h1,'Color','b');
h2 = plot(PSD_e);
set(h2,'Color','r');
hold off