📄 aarls.m
字号:
function [w,J]=aarls(L,var2,h,N,h1,lambda,delta,I);
%L=No. of iterations;
%var2=Variance of the plant noise;
%h=Plant impulse response;
%N=Length of the Adaptive Filter;
%h1=Coloring filter impulse response;
%lambda=Forgetting factor in the RLS algorithm;
%delta=Parameter in the RLS algorithm;
%I=No. of runs to be used for ensemble averaging;
J=zeros(L,1);
for k=1:I
x1=randn(L,1); x=filter(h1,1,x1);
v=sqrt(var2)*randn(L,1); d=filter(h,1,x)+v;
w=zeros(N,1); xd=zeros(N,1);
R_inv=(1/delta)*eye(N);
for n=1:L
xd=[x(n);xd(1:length(xd)-1)];
gbar=R_inv*xd;
g=gbar/(lambda+xd'*gbar);
y=w'*xd;
e=d(n)-y;
w=w+g*e;
R_inv=(1/lambda)*(R_inv-g*gbar');
J(n)=J(n)+e^2;
end
end
J=J/I;
nn=0:L-1;plot(nn,10*log10(J));
xlabel('Iteration no.');ylabel('MSE in dB');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -