% pendulum.al % % Variable Definition % newtonian e bodies a, b constants la, lb, g variables q{2}', u{2}' % % Mass Properties % mass a = ma, b = mb inertia a, a1 inertia b, b1, b2, b3 % % Generalized Speeds % q1' = u1 q2' = u2 % % Kinematics % simprot(e, a, 1, q1) simprot(a, b, 3, q2) w_a_e> = q1'*a1> w_b_e> = w_a_e> + q2'*b3> v_ao_e> = la*q1'*a2> v_bo_e> = lb*q1'*a2> alf_a_e> = dt(w_a_e>, e) alf_b_e> = dt(w_b_e>, e) a_ao_e> = dt(v_ao_e>, e) a_bo_e> = dt(v_bo_e>, e) % % Forces % gravity(-g*e3>) f = fr() fstar = frstar() zero = fr() + frstar() kane() solve(zero, [u1', u2']) output t, q2 output t, q1 units q{1:2} = deg units u{1:2} = deg/s units [ma; mb] = kg units [la; lb] = m units g = m/s^2 units [a1; b1; b2; b3] = kg*m^2 input ma = 0.01, mb = 0.1 input g = 9.81 input la = 0.075, lb = 0.2 input a1 = 0.000005 input b1 = 0.00025, b2 = 0.00005, b3 = 0.0002 code dynamics() pendulum.c, subs