Advertisement
Ostu

Untitled

May 31st, 2021
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.42 KB | None | 0 0
  1. for x=-9:10
  2.     for y=-9:10
  3. [t,z]=ode45(@robot, 0:0.01:15, [x;y;pi/4]);
  4. hold on
  5. plot( z(:,1), z(:,2))
  6.     end
  7. end
  8. function dz=robot(t,z)
  9.     x=z(1);
  10.     y=z(2);
  11.     theta=z(3);
  12.    
  13.     alfa=atan2(y,x)-theta;
  14.     beta=atan2(y,x);
  15.     e=sqrt(x^2+y^2);
  16.    
  17.     v=-e*cos(alfa);
  18.     w=alfa+cos(alfa)*sin(alfa)+beta*cos(alfa)*sin(alfa)/alfa;
  19.    
  20.     dz=[v*cos(theta) ;...
  21.         v*sin(theta) ;...
  22.         w];
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement