Guest User

Untitled

a guest
Sep 10th, 2013
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.53 KB | None | 0 0
  1. function dxdt = bot_susp_1d(t, xin, m, k, c, tspan, ground, groundp)
  2. %UNTITLED2 Summary of this function goes here
  3. %   state xin = [ x(t) x'(t) y(t) y'(t) L(t) L'(t)]
  4.     g = 9.8;
  5.    
  6.     % Divide up state into named variables
  7.     x = xin(1);
  8.     xp = xin(2); % dxdt(1)
  9.    
  10.     % get y(t) and y'(t)
  11.     y  = interp1(tspan, ground, t ,'cubic');
  12.     yp = interp1(tspan, groundp, t ,'cubic');
  13.  
  14.     % Dynamics equation, mass-spring-damper
  15.     xpp = (c*yp + k*y - (c*xp + k*x + m*g))/m;  %dxdt(2)
  16.  
  17.     dxdt = [ xp ; xpp ];
  18. end
Advertisement
Add Comment
Please, Sign In to add comment