system of 3 equation with 3 unknown, with two 2nd order equation

조회 수: 3 (최근 30일)
SYML2nd
SYML2nd 2020년 2월 23일
댓글: Star Strider 2020년 2월 23일
Hi,
I am trying to solve a system of 3 equation with 3 unknown, with two 2nd order equation using this code, but unfortunately I don't understand why I do not obtain the result. Thank you in advance
syms QV3 QV2 QVl
eqn1 = 17.79 == QV3 + QV2+QVl;
eqn2 = 0.25*QV3.^2 == 0.14 * QV2^2;
eqn3 = 0.25*QV3.^2 == 3.89* QVl^2;
sol = solve([eqn1, eqn2, eqn3], [QV3 , QV2, QVl])
QV3Sol = sol.QV3
QV2Sol = sol.QV2
QVLsol = sol.QVl

채택된 답변

Star Strider
Star Strider 2020년 2월 23일
The resuillts are strictly numerical (not containing symbolic variables), so use vpasolve instead of solve:
syms QV3 QV2 QVl
eqn1 = 17.79 == QV3 + QV2+QVl;
eqn2 = 0.25*QV3.^2 == 0.14 * QV2^2;
eqn3 = 0.25*QV3.^2 == 3.89* QVl^2;
sol = vpasolve([eqn1, eqn2, eqn3], [QV3 , QV2, QVl])
QV3Sol = sol.QV3
QV2Sol = sol.QV2
QVLsol = sol.QVl
producing:
QV3Sol =
-214.86507282291207239983881906658
6.8692131509642582629301134641865
-30.161934858502498504240076448371
8.5414023987755051080751389638705
QV2Sol =
287.1255310312749278205504662485
9.1793721884393279626540627283888
40.305580843825110030042867255874
11.413929063852511018159550534661
QVLsol =
-54.470458208362855420711647181924
1.7414146605964137744158238074247
7.6463540146773884741972091924965
-2.1653314626280161262346894985318
These are however still symbolic values. To use them in other calculations, convert them to double-precision values with the double function.
  댓글 수: 2
SYML2nd
SYML2nd 2020년 2월 23일
Thank you. Now it works. I don't understand why I can only find numerical result (I am a little bit rusty in math maybe). Why do I have 4 solution for each variable?
Star Strider
Star Strider 2020년 2월 23일
My pleasure.
It produces strictly numerical results because they are not functions of any other symbolic variables. Any variables would appear in the vpasolve solutions if they existed (and if so, it wouild not be possible to use the double function to convert them to double-precision values).
There are 4 solutions for each variable because each variable is a -order polynomial.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by