Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- R=1;
- thetav=[pi/3; pi/5];
- xv=[0, R*cos(thetav(1)), R*cos(thetav(1)) + R*cos(thetav(2))];
- yv=[0, R*sin(thetav(1)), R*sin(thetav(1)) + R*sin(thetav(2))];
- opts={'-o','MarkerSize',10, 'MarkerFaceColor', 'blue', 'LineWidth', 3}; %Färger
- clf; plot(xv,yv,opts{:}); drawnow;
- %Newtons metod fler varre
- f=@(thetav) [sin(thetav(1)) + sin(thetav(2)) - 1.3; cos(thetav(1)) + cos(thetav(2)) - 1.3];
- J=@(thetav) [cos(thetav(1)), cos(thetav(2)); -sin(thetav(1)), -sin(thetav(2))];
- h=inf;
- TOL=1e-5;
- x=[pi/3;pi/5];
- while (norm(h)>TOL)
- h=J(x)\f(x);
- x=x-h;
- end
- x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement