Info

この質問は閉じられています。 編集または回答するには再度開いてください。

NEED URGENT HELP! Code keeps returning the desired variables as empty 0x1

1 ビュー (過去 30 日間)
Michael
Michael 2022 年 11 月 29 日
終了済み: Walter Roberson 2022 年 11 月 29 日
My code is currently only returning Empty sym: 0-by-1.
CODE:
clear;
clc;
%Knowns
%Knowns
i = sqrt(-1);
Theta_AB = 0;
Theta_DB = 90*(pi/180);
Omega_AB = 0;
Alpha_AB = 0;
Omega_AC = 15*(360/1)*(pi/180)*(1/60);
R_AB = 24;
syms R_AC R_CD R_DB R_EB Theta_AC Theta_CD Omega_CD Omega_DB Alpha_AC Alpha_CD Alpha_DB
%Real
EqnRP1 = R_AC*cos(Theta_AC) + R_CD*cos(Theta_CD) + R_DB*cos(Theta_DB) - R_AB*cos(Theta_AB) == 0;
EqnRV1 = R_AC*Omega_AC*(-sin(i*Theta_AC)) + R_CD*Omega_CD*(-sin(Theta_CD)) + R_DB*Omega_DB*(-sin(Theta_DB)) - R_AB*Omega_AB*(-sin(Theta_AB)) == 0;
EqnRA1 = R_AC*Omega_AC^2*(-cos(Theta_AC)) + R_AC*Alpha_AC*(-sin(Theta_AC)) + R_CD*Omega_CD^2*(-cos(Theta_CD)) + R_CD*Alpha_CD*(-sin(Theta_CD)) + R_DB*Omega_DB^2*(-cos(Theta_DB)) + R_DB*Alpha_CD*(-sin(Theta_DB)) - R_AB*Omega_AB^2*(-cos(Theta_AB)) - R_AB*Alpha_CD*(-sin(Theta_AB)) == 0;
%Imagininary
EqnIP1 = R_AC*i*sin(Theta_AC) + R_CD*i*sin(Theta_CD) + R_DB*i*sin(Theta_DB) - R_AB*i*sin(Theta_AB) == 0;
EqnIV1 = R_AC*Omega_AC*i*cos(Theta_AC) + R_CD*Omega_CD*i*cos(Theta_CD) + R_DB*Omega_DB*cos(Theta_DB) - R_AB*Omega_AB*cos(Theta_AB) == 0;
EqnIA1 = R_AC*Omega_AC^2*i*(cos(Theta_AC)) + R_AC*Alpha_AC*i*(-sin(Theta_AC)) + R_CD*Omega_CD^2*i*(cos(Theta_CD)) + R_CD*Alpha_CD*i*(-sin(Theta_CD)) + R_DB*Omega_DB^2*i*(cos(Theta_DB)) + R_DB*Alpha_CD*i*(-sin(Theta_DB)) - R_AB*Omega_AB^2*i*(cos(Theta_AB)) - R_AB*Alpha_CD*i*(-sin(Theta_AB)) == 0;
%Additional Constraints
Eqn1 = Theta_AC == Theta_CD;
Eqn2 = 739.2 == Omega_DB*R_EB;
Eqn3 = R_AC + R_EB <= R_CD + R_AB;
Eqn4 = Alpha_DB * R_EB <= 3;
Eqn5 = R_EB <= R_AB + 6;
[R_AC, R_CD, R_DB, R_EB, Theta_AC, Theta_CD, Omega_CD, Omega_DB, Alpha_AC, Alpha_CD, Alpha_DB] = vpasolve([EqnRP1, EqnRV1, EqnRA1, EqnIP1, EqnIV1, EqnIA1, Eqn1, Eqn2, Eqn3, Eqn4, Eqn5],[R_AC, R_CD, R_DB, R_EB, Theta_AC, Theta_CD, Omega_CD, Omega_DB, Alpha_AC, Alpha_CD, Alpha_DB]);
R_AC
R_CD
R_EB
COMMAND WINDOW:
R_AC =
Empty sym: 0-by-1
R_CD =
Empty sym: 0-by-1
R_EB =
Empty sym: 0-by-1
>>

回答 (1 件)

John D'Errico
John D'Errico 2022 年 11 月 29 日
編集済み: John D'Errico 2022 年 11 月 29 日
Must a solution exist for all problems? No. Of course not. Those empty syms are a signal that MATLAB was unable to solve your problem. That does not mean there is no solution. Just that one could not be found.
The fact is however, that while it LOOKs like you have 11 equations, some of them are inequalities. And that means that there MAY be infinitely many solutions. But this is a very complicated system. So hoping for some explicit solution is way too optimistic.
  2 件のコメント
Michael
Michael 2022 年 11 月 29 日
If I change the inequalities to a definite answer, do you think that it may help? I have run systems like this before and gotten definite answers.

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by