clc;clear all;st=[1 2 2 1 2];alpha=0.6;w=[0.2 0.8; 0.6 0.4; 0.5 0.7; 0.9 0.3];disp('initial weight matrix');disp(w);x=[1 1 0 0; 0 0 0 1; 1 0 0 0; 0 0 1 1];disp(x);t=[st(2);st(3);st(4);st(5)];e=1;while (e<=3) i=1; j=1; k=1; disp('epoch='); e while(i<=4) for j=1:2 temp=0; for k=1:4 temp=temp+(w(k,j)-x(i,k))^2; end D(j)=temp; end if (D(1)<D(2)) J=1; else J=2; end disp('The winning unit is'); J disp('weight updation'); if J==t(i) w(:,J)=w(:,J)+alpha*(x(i,:)'-w(:,J)); else w(:,J)=w(:,J)-alpha*(x(i,:)'-w(:,J)); end w i=i+1 end temp=alpha(e); e=e+1; alpha(e)=0.5*temp; disp('first epoch completed'); disp('learning rate updated for second epoch'); alpha(e) end
MATLAB: It is a prog about linear vector quantisation neural network. while updating weight when negative value comes as a result it is showing an error.we can make those negative values to zero and can proceed iteratrations. iam umable to do it.plz help m
linear vector quantisationneural networknntraining
Best Answer