% Hebb rule with 2 D rotated input eta=0.15; %theta=pi/12; theta=pi/6; ang='\pi /6'; R=[cos(theta),sin(theta);-sin(theta),cos(theta)]; sig1=1; sig2=0.3; Iterations =225; figure hold on %axis equal %axis square axis([-2 2 -2 2]); %tt=['Angle=' num2str(theta)]; tt=['angle=' ang]; title(tt); w=0.01*(rand(2,1)-0.5); w_all=w; for ii=1:Iterations x1=sig1*(2*rand-1); x2=sig2*(2*rand-1); x=[x1,x2]*R; plot(x(1),x(2),'+'); y=x*w; w=w+eta*y*x'; %w=[w,w_new] w_all=[w_all,w]; plot(w(1),w(2),'or') pause(.02) drawnow end