plot the system of three equations
5 views (last 30 days)
Show older comments
I have a Dynamics problem, which I solved and I have three eqations with three unknows.

I'm pretty sure in this part of a code:
% 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=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;
But I need to have plots for V_A and V_Bx for theta [-70,70]. But what I do doesn't work as I need it to.
eqs = [eq1, eq2, eq3];
[theta_1,V_A,V_Bx]=vpasolve(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, [-70,70], 'Linewidth',2)
hold on
fplot(V_A, [-70,70], '-.*c')
hold off
Maybe You know what am I doing wrong?
0 Comments
Answers (1)
Stephan
on 1 Nov 2020
Edited: Stephan
on 1 Nov 2020
% 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
0 Comments
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!