Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. R=1;
  2. thetav=[pi/3; pi/5];
  3. xv=[0, R*cos(thetav(1)), R*cos(thetav(1)) + R*cos(thetav(2))];
  4. yv=[0, R*sin(thetav(1)), R*sin(thetav(1)) + R*sin(thetav(2))];
  5. opts={'-o','MarkerSize',10, 'MarkerFaceColor', 'blue', 'LineWidth', 3}; %Färger
  6. clf; plot(xv,yv,opts{:}); drawnow;
  7.  
  8. %Newtons metod fler varre
  9. f=@(thetav) [sin(thetav(1)) + sin(thetav(2)) - 1.3; cos(thetav(1)) + cos(thetav(2)) - 1.3];
  10. J=@(thetav) [cos(thetav(1)), cos(thetav(2)); -sin(thetav(1)), -sin(thetav(2))];
  11.  
  12. h=inf;
  13. TOL=1e-5;
  14. x=[pi/3;pi/5];
  15. while (norm(h)>TOL)
  16. h=J(x)\f(x);
  17. x=x-h;
  18. end
  19. x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement