cspect — spectral estimation (correlation method)
[sm,cwp]=cspect(nlags,ntp,wtype,x,y,wpar)
data if vector, amount of input data if scalar
data if vector, amount of input data if scalar
number of correlation lags (positive integer)
number of transform points (positive integer)
string : 're','tr','hm','hn','kr','ch' (window type)
optional window parameters for wtype='kr', wpar>0 and for wtype='ch', 0 < wpar(1) < .5, wpar(2) > 0
power spectral estimate in the interval [0,1]
calculated value of unspecified Chebyshev window parameter
Spectral estimation using the correlation method.
Cross-spectral estimate of x and y is calculated when both
x and y are given. Auto-spectral estimate of x is calculated
if y is not given.
rand('normal');rand('seed',0);
x=rand(1:1024-33+1);
//make low-pass filter with eqfir
nf=33;bedge=[0 .1;.125 .5];des=[1 0];wate=[1 1];
h=eqfir(nf,bedge,des,wate);
//filter white data to obtain colored data
h1=[h 0*ones(1:maxi(size(x))-1)];
x1=[x 0*ones(1:maxi(size(h))-1)];
hf=fft(h1,-1); xf=fft(x1,-1);yf=hf.*xf;y=real(fft(yf,1));
sm=cspect(100,200,'tr',y);
smsize=maxi(size(sm));fr=(1:smsize)/smsize;
plot(fr,log(sm))