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

3 views (last 30 days)
SYML2nd
SYML2nd on 23 Feb 2020
Commented: Star Strider on 23 Feb 2020
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

Accepted Answer

Star Strider
Star Strider on 23 Feb 2020
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 Comments
Star Strider
Star Strider on 23 Feb 2020
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!