PSD and Pwelch

14 vues (au cours des 30 derniers jours)
toolmotor beartiger
toolmotor beartiger le 8 Déc 2011
I used the function psd.
nfft=round(length(P)/2);
[p,f]=psd(P,nfft,2,nfft,round(nfft/2),'mean');
% [p,f] = cpsd(x,y,window,noverlap,nfft,fs);
[m,peak]=max(p);
area=cumtrapz(f,p);
Find50=find(area>=.50*area(end));
Find80=find(area>=.80*area(end));
Fmean=trapz(f,f.*p)/trapz(f,p);
Fpeak=f(peak);
F50=f(Find50(1));
F80=f(Find80(1));
I tried to calculate two signal cross power spectrum
[p,f] = cpsd(x,y,window,noverlap,nfft,fs);
[m,peak]=max(p);
area=cumtrapz(f,p);
Find50=find(area>=.50*area(end));
Find80=find(area>=.80*area(end));
Fmean=trapz(f,f.*p)/trapz(f,p);
Fpeak=f(peak);
F50=f(Find50(1));
F80=f(Find80(1));
But it is fail to get answer.
What is wrong?
  1 commentaire
Wayne King
Wayne King le 8 Déc 2011
Can you please format your code?

Connectez-vous pour commenter.

Réponses (1)

bym
bym le 20 Déc 2011
ummm...because your line calculating the cross power spectrum is commented out?

Community Treasure Hunt

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

Start Hunting!

Translated by