⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mywarma.m

📁 现代信号谱估计算法的matlab代码 调用函数代码
💻 M
字号:
function [a,gamma]=mywarma(y,n,m,M)
%
% The modified Yule-Walker ARMA method 
% given by equation (3.7.9) with the AR coefficients estimated
% using the overdetermined set of equation (3.7.4), where W is
% the identity matrix.
%
% [a,gamma]=mywarma(y,n,m,M)
% 
%      y     -> the data vector
%      n     -> AR model order
%      m     -> MA model order
%      M     -> the constant which determine the amount of 
%               overdetermination
%      a     <- the AR coefficients vector
%      gamma <- the onesided gamma in equation (3.7.8)

% Copyright 1996 by R. Moses

y=y(:);
N=length(y);             % data length

%-------------------- estimate the AR coefficients --------------------

% compute the standard biased ACS estimate [r(0) r(1) r(2) ...r(n)]
if (N <= m+M)
   disp('Error: m+M must be < the data length.');
   return
elseif (M<n)
   disp('Error: M must be >= n');
   return
end
r=zeros(m+M+1,1);
for i = 0 : m+M,
   r(i+1)=y(1:N-i)'*y(i+1:N)/N;
end

% form the r vector and R matrix in equation (3.7.1)
r1=r(m+2:m+M+1);
if ((m-n+1)>=0)
   R1=toeplitz(r(m+1:m+M),r(m+1:-1:m-n+2).');
else
   R1=toeplitz(r(m+1:m+M),[r(m+1:-1:1);conj(r(2:abs(m-n+1)+1))].');
end

% compute the AR coffecients

a=-R1\r1;
a=[1;a];

%-------------------- estimate the gamma coefficients --------------------
gamma=zeros(m+1,1);
for k = 0 : m,
   for j = 0 : n,
      for p = 0 : n,
         ind=k+p-j;
         if ind >=0
            gamma(k+1)=gamma(k+1)+a(j+1)*a(p+1)'*r(ind+1);
         else
            gamma(k+1)=gamma(k+1)+a(j+1)*a(p+1)'*r(abs(ind)+1)';
         end
      end
   end
end          

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -