Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Adaptive filter least mean square algorithm

Status
Not open for further replies.

MahmoudHassan

Full Member level 6
Joined
Oct 4, 2010
Messages
347
Helped
43
Reputation
88
Reaction score
39
Trophy points
1,328
Activity points
3,845
hi
iam trying to make learning for coefficients of adaptive filter using least mean square algorithm

this is my code and it doesn't work




function adfilter()

i=0:.2:7; %discrete steps.
delta=.075; %delta step.
d=sin(i); %desired signal pure signal.
M=length(d);
N=5; %length of H
h=zeros(1,N); %H system cefficents.
e=10000;
x=d+.25* rand(1,length(d)); %x signal which is the desired signal with noise.
a=1;
es=zeros(10000);%error squared.


res=zeros(length(d));
while (a<100000) %iterations

for n=5:M
x1=x(n:-1:n-4);
y=h*x1';
res(n)=y;
e=d(n)-y;
h=h+delta*e*x1;

end
es=sum(e*e');
a=a+1;

end

subplot(3,2,1)
stem(d)
title('d')
subplot(3,2,2)
stem(res)
title('y')
subplot(3,2,3)
stem(h)
title('h')
subplot(3,2,4)
stem(x)
title('x+noise')
subplot(3,2,5:6)
plot(es)
title('error')
disp('Number of iterations:')
disp(a)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top