aapowerspectraav1.m

来自「Adaptive Filtering Primer with MATLAB」· M 代码 · 共 25 行

M
25
字号

function[wa1,v]=aapowerspectraav1(a1,a2,a3,mu,M,N,avn,vr)
%aapowerspectraav1(a1,a2,a3,mu,M,N,avn,vrn);
wa=zeros(1,M);
dn=zeros(1,N);x=zeros(1,N);
for k=1:avn
   for n=4:N
       v(n)=vr*(rand-.5);
      dn(n)=-a1*dn(n-1)-a2*dn(n-2)-a3*dn(n-3)+v(n);
      x(n)=dn(n-1);
   end;
   [w]=aalms(x,dn,mu,M);
   wa=wa+w;
end;
wa1=wa/avn;
%this function gives averaged w's to be used for finding
%the approximate spectrum of the output of an AR filter
%up to the third order;M=number of LMS coefficients;
%N=length of desired signal and input signal to LMS filter;
%avn=number of times w's are averaged;the function is easily
%modified for AR filter with more coefficients;vr=controls the 
%variance of the white noise, multiplies the quantity (rand-.5);
%the function up to the first end produces the output from
%the AR filter with coefficients a1,a2 and a3; 

⌨️ 快捷键说明

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