t4 = 95; x0 = [60;45]; r1 = 10; r2 = 6; r3 = 8; r4 = 10; A = [r2*sind(x0(1)) r3*sind(x0(2)); -r2*cosd(x0(1)) -r3*cosd(x0(1))]; fx0 = [(r1+r4*cosd(t4)-r3*cosd(x0(2))-r2*cosd(x0(1))); (r4*sind(t4)-r3*sind(x0(2))-r2*sind(x0(1)))]; x = -A\fx0 + x0; diff = x0-x; while diff(1) < .0001 x0 = x; A = [r2*sind(x0(1)) r3*sind(x0(2)); -r2*cosd(x0(1)) -r3*cosd(x0(1))]; fx0 = [(r1+r4*cosd(t4)-r3*cosd(x0(2))-r2*cosd(x0(1))); (r4*sind(t4)-r3*sind(x0(2))-r2*sind(x0(1)))]; x = -A\fx0 + x0 diff = x0-x end
The loop I have is working until a certain point, until diff(1) = .0024, once it hits that though it will not go on. I have tried to increase the tolerance, but it doesn't work. I can't tell what is wrong.
Best Answer