MATLAB: System of 3 equation with 3 unknown, with two 2nd order equation

system solve unknown

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

Best Answer

  • 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.