微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微波和射频技术 > 天线设计和射频技术 > LMS method to findfilter coefficients of order 2. here is code

LMS method to findfilter coefficients of order 2. here is code

时间:04-05 整理:3721RD 点击:
plot is showing opposite result because of some mistake which i couldn't found so it is diverging instead of convergence.here is code
M=2; %tap weighth length
a(1:M)=[1 2.0260]% 2.1480 -1.1590];
l=M;mu=0.3;tol(1:M,1)=1e-4';

U=rand(1,l)';%input vector of length 10
R=U'*U; % R matrix
Wo=a';
d=Wo'*U;
P=U*d';
W_hat(1:M,1:10000)=0;
% %
i=2;
d_hat(1)=W_hat(:,1)'*U;
deltaJw(:,1)=-2*U*d'+2*U*U'*W_hat(:,1);
while(i<10000)
d_hat(i)=W_hat(1:M,i)'*U;
W_hat(:,i)=W_hat(:,i-1)-mu*U*(d-d_hat(i));
deltaJw(:,i)=-2*U*d'+2*U*U'*W_hat(:,i);

if (abs(W_hat(:,i)-Wo))<tol(:,1)
break
end
i=i+1;
end
figure(2)
plot(W_hat(1,:),W_hat(2,:),'or')
hold on
plot(Wo(1,1),Wo(2,1),'.')
axis ([-3 3 -3 3])
xlabel('w1(n)','FontSize',10)
ylabel('w2(n)','FontSize',10)
grid on
title('w2(n) vs w1(n) with step size 0.3','FontSize',14)

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top