Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. Ts=.008;
  2. WIN=.5;
  3. ORD=3;
  4. truncate = floor(WIN/Ts/2);
  5.  
  6. % Do the x position -> velocity
  7. [x_f, vx] = polyreg(x,t,Ts,WIN,ORD);
  8. % Do the x position
  9. [y_f, vy] = polyreg(y,t,Ts,WIN,ORD);
  10. % Do the z position
  11. [z_f, vz] = polyreg(z,t,Ts,WIN,ORD);
  12.  
  13. % recalculate a new range of t, because the xd is shorter than x by
  14. % floor(WIN/Ts/2)
  15. % remove from the beginning and the end
  16. td = t(truncate+1:length(t)-truncate);
  17.  
  18. % velocity -> acceleration
  19. [vx_f, ax] = polyreg(vx',td,Ts,WIN,ORD);
  20. [vy_f, ay] = polyreg(vy',td,Ts,WIN,ORD);
  21. [vz_f, az] = polyreg(vz',td,Ts,WIN,ORD);
  22.  
  23. % further truncation we lost data above.
  24. tdd = td(truncate+1:length(td)-truncate);
  25.  
  26. omega1=omega1(truncate+1:length(td)-truncate);
  27. omega2=omega2(truncate+1:length(td)-truncate);
  28. omega3=omega3(truncate+1:length(td)-truncate);
  29. omega4=omega4(truncate+1:length(td)-truncate);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement