plot the system of three equations

조회 수: 5 (최근 30일)
Kseniia Kudriavtceva
Kseniia Kudriavtceva 2020년 10월 31일
편집: Stephan 2020년 11월 1일
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?

답변 (1개)

Stephan
Stephan 2020년 11월 1일
편집: Stephan 2020년 11월 1일
% 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

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by