www.pudn.com > phsscal.zip > mprepower.m, change:2003-11-19,size:419b


function Nw=prepower(y,t,sample,a) 
%this function use to calculate psd of noise; 
Nw=0; 
h=t; 
for i=1:sample:t*sample, 
   p=0; 
   for j=1:sample, 
      z(j)=y(i+j-1); 
   end; 
   Z=abs(fft(z,sample)); 
    
   for n=1:sample, 
      temp=1; 
      for k=1:a, 
         temp=temp*Z(n); 
      end; 
      p=p+temp; 
   end; 
   p=p/sample; 
  % if(p<0.01), 
   %   h=h-1; 
   %end; 
   Nw=Nw+p; 
end; 
 
Nw=Nw/h;