📄 spa_corc.m
字号:
%----------------------------------------------------
%
% SPA_CORC.M
%
% Computes the autocorrelation matrix using forward
% and backward snapshots from signal x and order nq
% for the matrix.
%
% Requires:
%
% From the main program -The vector of data signal x
% - The order nq of the matrix
% Provides:
%
% ra(nq,nq) the correlation matrix estimate order nq
%
% Miguel Angel Lagunas Feb 1995
%------------------------------------------------------
function ra=spa_corc(x,nq);
n=length(x);l1=nq;isum=0;ra=zeros(nq,nq);
%%for i=1:n+nq-1;
for i=nq:n;
auso=zeros(nq,1);
if i<nq;
auso(nq-i+1:nq)=x(1:i)';
else;
if i<=n;
auso=x(l1-nq+1:l1)';l1=l1+1;
else;
auso(1:n+nq-i)=x(i-nq+1:n)';
end;
end;
%%if i>n-1;
%% disp(auso);pause;disp('hola');
%%end;
buso=flipud(auso);
ra=ra+(auso*auso');isum=isum+1;
%%ra=ra+(auso*auso'+buso*buso');isum=isum+1;
end;
ra=ra/(isum);
%%
%%n=length(x);
%%l1=1;l2=nq;xf=[];xb=[];luso=0;
%%while l2<=n;
%% auso=x(l1:l2);
%% xf=[xf;auso];xb=[xb;fliplr(auso)];
%% l1=l1+1;l2=l2+1;luso=luso+1;
%%end;
%%ra=0.5*(xf'*xf+xb'*xb)/luso;
%%ra=xf'*xf/luso;
%------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -