Advertisement
Ostu

Untitled

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