system of 3 equation with 3 unknown, with two 2nd order equation
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 个评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/273244/image.png)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!