1

我正在研究使用最小均方算法进行系统识别。我尝试使用 LMS 的方程式编写一些代码。根据算法步骤,误差和权重更新的计算看起来没问题。但是,它无法给出正确的输出。有人可以帮忙解决问题吗?

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

0 回答 0