主题:新手自己写的程序,不知道怎么改才能正确
z=[1,2,3,4;34,23,12,45;45,56,2,4;12,34,23,13];err=0.0000001;
for i=1:1000
w_old=[1,0,0,0]';
w_new=(z(tanh(w_old'*z))-(1-tanh(w_old'*z)))*w_old;
if abs(w_new'*w_new)-1>err
continue;
else
disp(w_new);
end
end[em18]
for i=1:1000
w_old=[1,0,0,0]';
w_new=(z(tanh(w_old'*z))-(1-tanh(w_old'*z)))*w_old;
if abs(w_new'*w_new)-1>err
continue;
else
disp(w_new);
end
end[em18]