I have two point-masses, each with mass ( m ), which are connected by a rigid, massless rod of length l . Mass 1 can move without friction on the vertical y-axis and mass 2 can move without friction on the horizontal x-axis, set up as below:
I've calculated and defined the EOM as:
syms g m l a da dda
r1 = [0 l*cos(a)]
r2 = [l*sin(a) 0]
dr1 = diff(r1, a)*da
dr2 = diff(r2, a)*da
T0 = 0.5*m*(dr1(1,2))^2 + 0.5*m*(dr2(1,1))^2;
T = simplify(T0)
V = m*g*l*cos(a)
L = T - V
M = jacobian(diff(L,da), a)*da + jacobian(diff(L,da), da) * dda - diff(L,a) == 0
dda = solve(M, dda)
Which gives me dda = gsin(a)/l (where a is the angle between mass 1 and the y-axis). This is where I'm stuck.. how can I use Matlab to set up a function f(t, a) in order to track the position of each weight as they move due to gravity so that I can plot it?
I apologise for the open endedness of my question, I am very new and entirely self taught on how to use Matlab.