文档介绍:自适应算法变步长LMS和RLS的Mat lab仿真分析
摘 要:在目前的移动通信领域中,克服多径干扰,提高通信质量是一个非常重要 的问题,而自适应滤波器能很好的解决这个问题,自适应滤波器的核心是自适应 算法。具体地讲述自适应算法的理论体系f n<20
mu=0. 32;
else
mu=0. 15;
end
W=W+mu*u*e(n);
end
figure
plot(y)
figure plot (e)
2、RLS Matlab语言实现:
clear all close all hold off
% Number of system points
N=2000;
inp = randn (N, 1);
n = randn (N, 1);
[b, a] = butter (2, 0. 25);
Gz = tf (b, a, - 1);
%y(n)二bl*u(n)+b2*u(n- l)+b3*u(n- 2)- al*y(n- 1)- a2*y(n- 2) h= [b - a(2:length(a))];
%channel system order fixed as we have 5 elements (3 in a and 2 in b) inporder=3;
outorder=2;
sysorder = inporder + outorder ;
y = lsim(Gz, inp);
%add some noise
n 二 n * std(y)/ (15^std(n));
d = y + n;
totallength=size (d,1);
%Take only 50 points for training ( N - inporder 47 = 50 -
3 )
N=50 ;
%begin of the algorithm
%forgetting factor lamda = ;
%initial P matrix delta = le2 ;
P = delta * eye (sysorder );
w = zeros ( sysorder , 1 );
for n = inporder : N
%u (n), u (n- 1), u(n- 2)
u=inp (n:- 1:n- inporder+1);
%d(n- l),d(n- 2)
outp= d(n- 1:- 1:n- outorder);
u=[u ; outp];
phi 二 u' * P ;
k = phi' / (lamda + phi * u );
y (n)二w' * u;
e(n) = d(n) - y (n);
w 二 w + k * e(n);
P = ( P - k * phi ) / lamda ;
% Just for plotting
Recordedw(l:sysorder, n)=w;
end
%check of results
for n = N+l : totallength
%u (n), u (n- 1), u(n- 2)
u = inp (n:- 1:n- inporder+1);
%d(n- l),d(n- 2)
outp=