1

I am studying about system identification using Least Mean Square algorithm. I tried with some code using the equations for LMS. Based on the algorithm steps, the calculation of the error and weight updates looks alright. However, it fails to give the correct output. Can somebody please help in fixing the problem?

clear all;
mu=0.05;
b=fir1(10,0.5,'low');
x = rand(1,30); 
d = filter(b,1,x);

w=zeros(1,15);

for n=1:length(x)-15-1
  temp=x(n:n+15-1);
  y=temp.*w(n); 
  e(n)=d(n)-y(n);
  w(n+1)=w(n)+mu*e(n)*x(n)';
end

subplot(2,1,1);stem(b);
legend('Actual'); 
xlabel('coefficient #'); 
ylabel('coefficient value');

subplot(2,1,2);stem(w);
legend('estimated'); 
xlabel('coefficient #'); 
ylabel('coefficient value');
Dev-iL
  • 23,742
  • 7
  • 57
  • 99
remya
  • 21
  • 3
  • Please explain how you judge what "looks alright" and what is "fails to give the correct output". What is the correct output? Please at least label this in the code. Also: [Why is “Can someone help me?” not an actual question?](https://meta.stackoverflow.com/questions/284236) – Dev-iL Feb 12 '18 at 09:46

0 Answers0