if any(t<=L)|any(t+L>xrow),
error('The relation L<T<=length(X)-L must be satisfied');
else
for icol=1:tcol,
if trace, disprog(icol,tcol,10); end; //disprog显示循环进程//
ti = t(icol); tau = 0:L;
R = x(ti+tau).*conj(x(ti-tau));
M4 = R(2:L+1).*conj(R(1:L)); //?//
diff=2e-6;
tetapred = H * (unwrap(angle(-M4))+pi); //unwrap,产生平滑的相位图//
while tetapred<0.0 , tetapred=tetapred+(2*pi); end;
while tetapred>2*pi, tetapred=tetapred-(2*pi); end;
iter = 1;
while (diff > 1e-6)&(iter<50),
M4bis=M4 .* exp(-j*2.0*tetapred);
teta = H * (unwrap(angle(M4bis))+2.0*tetapred);
while teta<0.0 , teta=(2*pi)+teta; end;
while teta>2*pi, teta=teta-(2*pi); end;
diff=abs(teta-tetapred);
tetapred=teta; iter=iter+1;
end;
fnormhat(icol,1)=teta/(2*pi);
end;
end;
end; |