Escolar Documentos
Profissional Documentos
Cultura Documentos
Arsalan
Khan
Assignment No 1:
Submitted to:
xi= rand(1000,1);
%%Order of Filter
N=5; (For better results, Higher order is considered)
for n=1:N
z(n) = 0;
for j=0:N-1
z(n) = z(n) + xi (n+j);
end
mov_avg(n) = z(n)/N;
end
%%Inputs
x=mov_avg
%%Desired Response
d=ones(1,N)
P = [Ry(1);
Ry(2);
Ry(3);
Ry(4);
Ry(5)]
%%Scaling Factor
mew=[0.023; 0.055; 0.069; 0.091];
%%Weight Vector
w=zeros(1,5);
for n=1:N-1
%%Error Equation
e(n) = d(n) - w(n) * x(n);
d= 1 1 1 1 1
p= 0.6293
1.3652
2.1522
2.8919
3.5782
Implement of RLS algorithm for Adaptive Filters:-
rnd= rand(1000,1);
N=4; (Order of Filter)
t=[0:N-1];
for
i=1:N
x(i) = 0;
for
j=0:N-1
x(i) = x(i) + rnd (i+j);
end
mov_avg(i) = x(i)/N;
end
y=mov_avg (Inputs)
d=ones(1,N) (Desired Response)
ita=10^4;
I=ones(1,N);
R=ita*I;
w=zeros(1,N);
for
i=1:N
e(i) = d(i) - y(i);
z(i) = R(i) * x(i);
q = x(i)' * z(i);
v = 1/(1+q);
zz(i) = v * z(i);
w(i+1) = w(i) + e(i)*zz(i);
R(i+1) = R(i) - zz(i)*z(i);
end
subplot(3,1,1)
plot(t,d)
title('Desired Signal')
subplot(3,1,2)
plot(t,x)
title('Noise Corrupted Signal')
subplot(3,1,3)
plot(t,e)
title('Error')