MGProjectileMotionKane.html  (MotionGenesis input/output).
   (1) % MotionGenesis file:  MGProjectileMotionKane.txt
   (2) % Copyright (c) 2009 Motion Genesis LLC.  All rights reserved.
   (3) %---------------------------------------------------
   (4) NewtonianFrame  N                 % Earth (baseball park).
   (5) Particle        Q                 % Baseball.
   (6) %---------------------------------------------------
   (7) Variable   x'',  y''              % Ball's horizontal and vertical measures.
   (8) Constant   g = 9.8 m/s^2          % Earth's gravitational acceleration.
   (9) Constant   b = 0.05 N*s/m         % Coefficient for air-resistance.
   (10) Q.SetMass( m = 145 grams )
   (11) SetGeneralizedSpeed( x', y' )
   (12) %---------------------------------------------------
   (13) %      Translational kinematics (position, velocity, acceleration).
   (14) Q.Translate( No, x*Nx> + y*Ny> )
-> (15) p_No_Q> = x*Nx> + y*Ny>
-> (16) v_Q_N> = x'*Nx> + y'*Ny>
-> (17) a_Q_N> = x''*Nx> + y''*Ny>

   (18) %---------------------------------------------------
   (19) %      Add relevant forces (aerodynamic and gravity).
   (20) Q.AddForce(  -m * g * Ny>  )
-> (21) Force_Q> = -m*g*Ny>

   (22) Q.AddForce(  -b * Q.GetVelocity(N)  )
-> (23) Force_Q> = -b*x'*Nx> + (-m*g-b*y')*Ny>

   (24) %---------------------------------------------------
   (25) %      Form equations of motion with Kane's method.  Solve for x'', y''.
   (26) DynamicEqn = System.GetDynamicsKane()
-> (27) DynamicEqn = [b*x' + m*x'';  m*g + b*y' + m*y'']

   (28) Solve( DynamicEqn = 0,   x'',  y''  )
-> (29) x'' = -b*x'/m
-> (30) y'' = -g - b*y'/m

   (31) %--------------------------------------------------------------------
   (32) %      Input integration parameters and initial values.
   (33) Input  tFinal = 3.8 sec,  tStep = 0.1 sec,  absError = 1.0E-7
   (34) Input  x = 0 m,  x' = 44.7 * cosDegrees(30) m/s
   (35) Input  y = 0 m,  y' = 44.7 * sinDegrees(30) m/s
   (36) %--------------------------------------------------------------------
   (37) %       List output quantities and solve ODEs.
   (38) OutputPlot  x m,  y m
   (39) ODE()  MGProjectileMotionKane

   (40) %---------------------------------------------------
Saved by Motion Genesis LLC.   Portions copyright (c) 2009-2017 Motion Genesis LLC. Rights reserved. Only for use with MotionGenesis.