📄 rec_fromphase2.m
字号:
%function [look2,ls_error]=rec_fromphase2(theta2,NF,N,Index)
function [look2,ls_error]=rec_fromphase_part(theta2,NF,N,Index,look_true)
% recovers the sequence based on its length (N) and its phase theta2, which
%might be known within a linear phase component
%
% This program is verified by phase_test.m
% phase_test.m was designed by Binning Chen on August 4, 1999
%
NO_DELAY=1;
theta2=theta2(:)';
ls_error=[];
nloop=1;
check=100;
for nn=-N:N
PHI1=zeros(1,length(Index));
phi1=zeros(1,length(Index));
psi1=theta2+2*pi/NF*[0:NF-1]*nn; % theta2 plus linear phase
psi1=reshape(psi1,NF,1);
if (abs(check) > 0. )
Lpos=N-1;
vec1=[1:Lpos];
pies1=(2*pi/NF)*[0:NF-1]'*vec1;
for jj=1:length(vec1)
ang1(Index,jj)=psi1(Index);
end
PHI1=sin(pies1(Index,:)+ang1(Index,:));
phi1=-sin(psi1(Index));
look2=inv((PHI1)'*PHI1)*(PHI1)'*phi1;
look2=[1 look2(1:Lpos)'];
[lk,ll]=max(abs(look2));
look2=look2/look2(ll);
rec=look2;
LOOK=fft(look2,NF);
RE=fft(rec,NF);
% check=mean((detrend(phase(RE))-detrend(theta2)).^2); %% Wrong !!!!!!!!!
check=mean((detrend(phase(RE)-unwrap(theta2))).^2);
ls_error=[ls_error log10(check)];
REC(nloop,:)=rec;
NN(nloop)=nn;
nloop=nloop+1;
end
look2=rec;
end % End of "for nn=-N:N"
[lsm, ls_index]=min(ls_error);
delay=ls_index-N-1;
if NO_DELAY
ls_index=N+1;
end
look2=REC(ls_index,:);
shift=NN(ls_index);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -