MGProjectileMotionFma.html  (MotionGenesis input/output).
   (1) % MotionGenesis file:  MGProjectileMotionFma.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) %---------------------------------------------------
   (12) %      Translational kinematics (position, velocity, acceleration).
   (13) Q.Translate( No,  x*Nx> + y*Ny> )
-> (14) p_No_Q> = x*Nx> + y*Ny>
-> (15) v_Q_N> = x'*Nx> + y'*Ny>
-> (16) a_Q_N> = x''*Nx> + y''*Ny>

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

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

   (23) %---------------------------------------------------
   (24) %      Form equations of motion with F = m*a.  Solve for x'', y''.
   (25) DynamicEqn[1] = Dot( Nx>,  Q.GetDynamics() )
-> (26) DynamicEqn[1] = b*x' + m*x''

   (27) DynamicEqn[2] = Dot( Ny>,  Q.GetDynamics() )
-> (28) DynamicEqn[2] = m*g + b*y' + m*y''

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

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

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