请问我的程序对么 求normal和normalandattack的累积归一化功率普密度
load normal; %----------载入数据
load normalandattack; %----------载入数据
A=normal(1:6000);
fs=1000;
nfft=1024;
window=hamming(512);
[Pxx,f]=pwelch(A,window,256,nfft,fs);
L=length(Pxx);
psd=zeros(L,1);
H=sum(Pxx);
for i=1:L
psd(i)=sum(Pxx(1:i))/H;
end;
plot(f,psd);
title('归一化PSD')
xlabel('频率')
ylabel('归一化功率谱密度')
hold on;
%==========================================================================
%==========================================================================
B=normalandattack(1:6000);
Fs=1000;
nfft=1024;
window=hamming(512);
[Pxx2,f2]=pwelch(B,window,256,nfft,fs);
L2=length(Pxx2);
psd2=zeros(L2,1);
H2=sum(Pxx2);
for i=1:L2
psd2(i)=sum(Pxx2(1:i))/H2;
end;
i=1:L2;
plot(f2,psd2,'r');
axis([0,50,0,1])
legend('normal','normalandattack')
title('NCPSD比较')
xlabel('频率')
ylabel('NCPSD')
[求助]关于累积归一化功率普密度