1
Computer exercise 5: Recursive Least Squares
(RLS)
This computer exercise deals with the RLS algorithm. The example applica
tion is adaptive channel equalization, which has been introduced in compu
ter exercise 2. A description can be found in Haykin, edition 4, chapter 5.7,
pp. 285291, (edition 3: chapter 9.7, pp. 412421),
Computer Experiment on
Adaptive Equalization
(using the LMS algorithm). In this exercise you should
compare the RLS algorithm and the LMS algorithm. An implementation of
the LMS algorithm can be downloaded form the course web page, computer
exercise 2.
Computer exercise 5.1
The RLS update equations are given by
k
(
n
) =
λ

1
P
(
n

1)
u
(
n
)
1 +
λ

1
u
H
(
n
)
P
(
n

1)
u
(
n
)
ξ
(
n
) =
d
(
n
)

h
w
(
n

1)
u
(
n
)
h
w
(
n
) =
h
w
(
n

1) +
k
(
n
)
ξ
*
(
n
)
P
(
n
) =
λ

1
P
(
n

1)

λ

1
k
(
n
)
u
H
(
n
)
P
(
n

1)
.
Create a function in Matlab that takes an input vector
u
and a reference
signal
d
, both of length
N
, and calculates the error
xi
for all time instants.
function [xi,w]=rls(lambda,M,u,d,delta)
%
Recursive Least Squares
%
Call:
%
[xi,w]=rls(lambda,M,u,d,delta);
%
%
Input arguments:
%
lambda
= forgetting factor, dim 1x1
%
M
= filter length, dim 1x1
%
u
= input signal, dim Nx1
%
d
= desired signal, dim Nx1
%
delta
= initial value, P(0)=delta^1*I, dim 1x1
%
%
Output arguments:
%
xi
= a priori estimation error, dim Nx1
%
w
= final filter coefficients, dim Mx1
Use
h
w
(0) = [0
,
0
,...,
0]
T
as initial values for the Flter coe±cients. ²or the
initial value of the inverse matrix
P
(0) choose a diagonal matrix with the
Adaptive Signal Processing 2007
Computer exercise 5