做毕业设计,刚接触MATLAB变成,这个BUG是种解决不了,求各位大神帮帮忙



rs(1)=12;rs(2)=4;rs(3)=10;rs(4)=7;th(1)=0;th(2)=45*pi/180;th(3)=100*pi/180;dth=5*pi/180;for i=1:72 th2=th(1);th3bar=th(2);th4bar=th(3); epsilon=1.0E-6;f=[rs(3)*cos(th3bar)-rs(4)*cos(th4bar)+rs(2)*cos(th2)-rs(1); rs(3)*sin(th3bar)-rs(4)*sin(th4bar)+rs(2)*sin(th2)]; while norm(f)>epsilon J=[rs(3)*sin(th3bar) rs(4)*sin(th4bar); rs(3)*cos(th3bar) -rs(4)*cos(th4bar)]; dth=inv(J)*(-1.0*f); th3bar=th3bar+dth(1); th4bar=th4bar+dth(2); f=[rs(3)*cos(th3bar)-rs(4)*cos(th4bar)+rs(2)*cos(th2)-rs(1); rs(3)*sin(th3bar)-rs(4)*sin(th4bar)+rs(2)*sin(th2)]; end th3=th3bar; th4=th4bar; angles(i,:)=[th(1) th3 th4] th(1)=th(1)+dth; th(2)=ths(1); th(3)=ths(2);end