ParticlePendulumFma.html  (MotionGenesis input/output).
   (1) % MotionGenesis file:  ParticlePendulumFma.txt
   (2) % Problem: Particle pendulum with air resistance.  
   (3) % Copyright (c) 2009 Motion Genesis LLC.  All rights reserved.
   (4) %------------------------------------------------------------
   (5) NewtonianFrame N            % Earth
   (6) RigidFrame     B            % Massless cable.
   (7) Particle       Q            % Particle at end of cable.
   (8) %------------------------------------------------------------
   (9) Q.SetMass( m = 100 kg )
   (10) Constant  g = 9.8 m/s^2     % Earth's gravitational acceleration
   (11) Constant  L = 50 m          % Cable length 
   (12) Constant  bAir = 2.0 N*s/m  % Air-resistance constant
   (13) Variable  theta''           % Pendulum swing angle
   (14) Variable  Tension           % Tension in cable.
   (15) %------------------------------------------------------------
   (16) %       Rotation and translation kinematics.
   (17) B.RotateZ( N, theta )
-> (18) B_N = [cos(theta), sin(theta), 0;  -sin(theta), cos(theta), 0;  0, 0, 1]
-> (19) w_B_N> = theta'*Bz>
-> (20) alf_B_N> = theta''*Bz>

   (21) Q.Translate( No,  -L*By> )
-> (22) p_No_Q> = -L*By>
-> (23) v_Q_N> = L*theta'*Bx>
-> (24) a_Q_N> = L*theta''*Bx> + L*theta'^2*By>

   (25) %------------------------------------------------------------
   (26) %       Contact and distance forces on Q.
   (27) Q.AddForce( -m*g*Ny> + Tension*By> - bAir*Q.GetVelocity(N) )
-> (28) Force_Q> = -bAir*L*theta'*Bx> + Tension*By> - m*g*Ny>

   (29) %------------------------------------------------------------
   (30) %       Form equations of motion with  F = m *a  
   (31) ZeroFma[1] = Dot( Bx>,  Q.GetDynamics() )
-> (32) ZeroFma[1] = m*g*sin(theta) + L*(bAir*theta'+m*theta'')

   (33) ZeroFma[2] = Dot( By>,  Q.GetDynamics() )
-> (34) ZeroFma[2] = m*g*cos(theta) + m*L*theta'^2 - Tension

   (35) Solve( ZeroFma,  theta'',  Tension )
-> (36) theta'' = -(m*g*sin(theta)+bAir*L*theta')/(m*L)
-> (37) Tension = m*(g*cos(theta)+L*theta'^2)

   (38) %------------------------------------------------------------
   (39) %       Initial values and numerical integration parameters.
   (40) Input   theta = 60 deg,  theta' = 0 deg/sec
   (41) Input   tFinal = 120 sec,  tStep = 0.1 sec
   (42) %------------------------------------------------------------
   (43) %       List output quantities and solve ODEs.
   (44) OutputPlot  t sec,  theta degrees,  Tension Newtons
   (45) ODE() ParticlePendulumFma

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