ayina
Newbie level 6
- Joined
- Oct 19, 2013
- Messages
- 14
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 3
- Location
- pakistan
- Activity points
- 124
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','FontSize',10)
ylabel('w2','FontSize',10)
grid on
title('w2 vs w1 with step size 0.3','FontSize',14)
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','FontSize',10)
ylabel('w2','FontSize',10)
grid on
title('w2 vs w1 with step size 0.3','FontSize',14)