# solving 4 equations with 4 unknowns

14 vues (au cours des 30 derniers jours)
Hamza Harbi le 7 Mar 2023
why do matlab gives two values for each unknown in the following system?
syms a b d e
eqn1 = a+b-4 == 0;
eqn2 = d+e-5 == 0;
eqn3 = a + b/2 + d/2 - 6.5/1.3 == 0;
eqn4 = d*b - exp(1.51)*e*a == 0;
[a,b,d,e]=solve(eqn1,eqn2,eqn3,eqn4)
a =
b =
d =
e =
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (2)

John D'Errico le 7 Mar 2023
Modifié(e) : John D'Errico le 7 Mar 2023
Because there are two solutions.
For example, how many solutions would you expect to see for the problem
syms x
xsol = solve(x^2 + x + 2,x)
xsol =
Two, of course, this is just a quadratic polynomial. Would you have expected only one solution? If then, which one?
And, while you may not think of your problem as being implicitly a quadratic in a sense it is one. That is, look at the products of variables in eqn4. If you eliminate some of the variables using substitution, at the end, you would find one quadratic polynomial in one unknown. Ergo, two solutions. And once you then have two solutions for that final variable, substituting back in to recover the other variables yields EXACTLY two solutions for each of them.
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

William Rose le 7 Mar 2023
Modifié(e) : William Rose le 7 Mar 2023
@Hamza Harbi, because the equation has two solutions. The first values of a,b,d,e are one solution; the second values of a,b,d,e are another.
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Conversion Between Symbolic and Numeric dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by