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');