% Given
syms theta
W_A=100;
m_A=W_A/32.2;
W_B=20;
m_B=W_B/32.2;
L=15;
theta_0=deg2rad(70);
% Solve the system of three equations
syms theta_1 V_A V_Bx
eq1 = W_A*L*(cos(theta)-cos(theta_0))-1/2*m_A*V_A^2-1/2*m_B*V_Bx^2+W_A*L;
eq2 = m_B*V_Bx+m_A*(V_Bx+L*theta_1*cos(theta));
eq3 = -V_A^2+(V_Bx+ L*theta_1*cos(theta))^2+(L*theta_1*sin(theta))^2;
eqs = [eq1, eq2, eq3];
[theta_1,V_A,V_Bx]=solve(eqs,[theta_1,V_A,V_Bx])
% Plot the velocity of the trolley and the speed of the rider as a function of the angle θ of the first half of a full swing
fplot(V_Bx, [-theta_0,theta_0], 'Linewidth',2)
hold on
fplot(V_A, [-theta_0,theta_0], '-.*c')
hold off