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 dynamics equations with Kane's method.
   (26) DynamicEqns = System.GetDynamicsKane()
-> (27) DynamicEqns = [b*x' + m*x'';  m*g + b*y' + m*y'']

   (28) %---------------------------------------------------
   (29) %      Solve dynamics equations for x'', y''.
   (30) Solve( DynamicEqns = 0,   x'',  y''  )
-> (31) x'' = -b*x'/m
-> (32) y'' = -g - b*y'/m

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

   (42) %---------------------------------------------------
Saved by Motion Genesis LLC.   Command names and syntax: Copyright (c) 2009-2019 Motion Genesis LLC. All rights reserved.