You are on page 1of 9

LMS Algorithm - Computer

Experiments
Experiment 1: Adaptive Predictor
AR(1) Process
Autoregressive process of order 1 is defined as:
u ( n )=au ( n1 ) +v ( n)
where,
'a' is the parameter of AR(1) process
'v(n)' is WGN with variance

2v

Adaptive First order Predictor

u(n)

Z-

u(n-1)

w (n)
w (n)u (n 1)
+

f(n)

Fig 1: Adaptive First order Predictor

LMS weight update equation is:


w
^ ( n+1 )=^
w ( n )+ u ( n1 ) f (n)
f ( n )=u ( n ) w
^ ( n ) u(n1)

Experiment Results
Experiment is carried out with the following cases:
Case1:
a= -0.99
Variance of u(n)= 0.93627
Case2:
a= +0.99
Variance of u(n)= 0.995
The Step size parameter is taken as =0.05 and initial condition

Steps:
1. Generate AR process
u ( n )=au ( n1 ) +v ( n)

2. Initialize
3. Update

w
^ ( 0 )=0
w
^ (n )

w
^ ( n+1 )=^
w ( n )+ u ( n1 ) f (n)

w
^ ( 0 )=0

f ( n )=u ( n ) w
^ ( n ) u(n1)

4. Repeat step 3 for 500 iterations.


5. Repeat steps 1 to 4 for 100 times and compute ensemble average of
w
^ (n )

Figure 2 shows the transient behavior of


E (w
^ (n ))

w
^ ( n ) . It also shows the

obtained by the ensemble averaging of 100 independent trials.

The experimental learning curves of adaptive first order prediction for


varying step size parameter is shown in Fig.

Problem 5.21
AR(2) Process
Autoregressive process of order 2 is defined as:
u ( n )=a1 u ( n1 )a2 u ( n1 ) + v (n)
a1=0.1
a2=0.8
2
a) Noise variance v

2
such that u =1

( 1a2 ) (( 1+ a2 ) a1 ) 2
=
u
( 1+ a2 )
2
v

v =0.27

Matlab Code for different realization of u(n)


var_v=(1-a2)*((1+a2)^2-a1^2)/(1+a2);
% initial values of u(n)
u(1)=var_v*randn(1,1); %
u(2)=-a1*u(1)+var_v*randn(1,1);
for n=3:N
u(n)=-a1*u(n-1)-a2*u(n-2)+var_v*randn(1,1);
end

You might also like