solving 5 nonlinear equations

I want to solve five nonlinear equations for five unknowns. How to solve in matlab?
The equations are-
32.5=2*sqrt((a*b-e^2)/(a*((1/c)+2/(sqrt(a*b)+e))))
81=2*sqrt(sqrt((a^2-d^2)/(b((2/(a-d))+(2/(a+d)))))*(sqrt((a*b-e^2)/(a*((1/c)+2/(sqrt(a*b)+e))))))
230=b-(2*e^2/(a+d))
0.3=(b*d-e^2)/(b*a-e^2)
0.3=e/(a+d)
Thanks.

 Risposta accettata

If you have the Symbolic Math Toolbox, this will give you one set of solutions:
syms a b c d e
Eqns = [32.5 == 2*sqrt((a*b-e^2)/(a*((1/c)+2/(sqrt(a*b)+e))));
81 == 2*sqrt(sqrt((a^2-d^2)/(b*((2/(a-d))+(2/(a+d)))))*(sqrt((a*b-e^2)/(a*((1/c)+2/(sqrt(a*b)+e))))));
230 == b-(2*e^2/(a+d));
0.3 == (b*d-e^2)/(b*a-e^2);
0.3 == e/(a+d)];
[as,bs,cs,ds,es] = vpasolve(Eqns, [a,b,c,d,e])
All the solutions are complex, so they may have complex-conjugate solutions as well. I will leave you to explore those.

4 Commenti

Note that Star Strider has added in a multiplication that you missed in your second equation, near the portion "b((2/(a-d))"
Walter Roberson
Walter Roberson il 10 Lug 2017
Modificato: Walter Roberson il 10 Lug 2017
The complete set of solutions is approximately
a = 259.1635046015542, b = 295.7619655879815, c = 1.064584012228196, d = 106.1807486650092, e = 109.6032759799690
a = -120.7553501645316+171.5673833557526*I, b = 200.2965219750578+36.61070970447526*I, c = 1.192404763279707-0.9286936846010984e-1*I, d = -44.26397219625907+31.82544833577654*I, e = -49.50579670823716+61.01784950745874*I
a = -120.7553501645316+171.5673833557526*I, b = 200.2965219750578+36.61070970447526*I, c = 1.183383955111476-0.6923795049260059e-1*I, d = -44.26397219625907+31.82544833577654*I, e = -49.50579670823716+61.01784950745874*I
a = -120.7553501645316-171.5673833557526*I, b = 200.2965219750578-36.61070970447526*I, c = 1.192404763279707+0.9286936846010984e-1*I, d = -44.26397219625907-31.82544833577654*I, e = -49.50579670823716-61.01784950745874*I
a = -120.7553501645316-171.5673833557526*I, b = 200.2965219750578-36.61070970447526*I, c = 1.183383955111476+0.6923795049260059e-1*I, d = -44.26397219625907-31.82544833577654*I, e = -49.50579670823716-61.01784950745874*I
However, these solutions depend upon "0.3" in the original equations meaning "3/10 exactly" : it the "0.3" are intended to convey "a number between 0.25 inclusive and 0.35 exclusive" then these are not the correct solutions.
Walter Roberson
Walter Roberson il 10 Lug 2017
Modificato: Walter Roberson il 10 Lug 2017
For example, if the final 0.3 were really 0.31 then the solution would change from
a = 259.1635046015543, b = 295.7619655879812, c = 1.064584012228195, d = 106.1807486650092, e = 109.6032759799690
to
a = 262.1789467186743, b = 301.4328240934383, c = 1.058495937853918, d = 109.4798675031687, e = 115.2142324087714
If you let the final 0.3 be 0.3+delta for some delta presumably in the range -0.05 to +0.05 (that is, you assume 0.3 is a rounded value instead of 3/10 exactly), then the final solution involves large numbers multiplied by powers of delta up to delta^50. For abs(delta) < 1 those terms get very small, but this gives you an ideal of how very important it is to not attempt to find exact solutions to equations that involve floating point numbers.
This is an interesting problem. Try some case below:
1: Taking "3/10' as "-10", real number solution:
a: -1116.42814745858
b: -0.14494811265632
e: 11.5072474056132
c: -12.0995087597244
d: 1115.27742271802
2: Taking "3/10' as "-5", real number solution:
a: 616.406269419948
b: 1.27542919070194
e: 22.8724570809345
c: -26.5477709060796
d: -620.980760836136
3: Taking "3/10' as "0", real number solution:
a: 210.846823805096
b: 230
e: -5.50683766803909E-161
c: 1.16019523942894
d: 1.05335763282267E-160
4: Taking "3/10' as "0.1", real number solution:
a: 214.022434088449
b: 234.751776376541
e: 23.7588818827026
c: 1.148178022009
d: 23.5663847385774
5: Taking "3/10' as "0.2", real number solution:
a: 226.651538558968
b: 252.564957781941
e: 56.4123944548472
c: 1.11542080793499
d: 55.4104337152429
6: Taking "3/10' as "0.35", real number solution:
a: 291.915645771019
b: 337.717161812537
e: 153.881659732203
c: 1.03363195571106
d: 147.746239178151
7: Taking "3/10' as "0.5", real number solution:
a: 852.513827599216
b: 1023.08265336835
e: 793.08265336835
c: 0.926592791567609
d: 733.651479137491
8: Taking "3/10' as "1.5", real number solution:
a: 29.7882470501465
b: 20.1947124949364
e: -69.935095835023
c: -1.99496910118526
d: -76.4116442734963
9: Taking "3/10' as "3.5", real number solution:
a: 257.625789918568
b: 2.26431063362606
e: -32.5336699094821
c: 4.31690559130787
d: -266.92112417842
10: Taking "3/10' as "5.0", real number solution:
a: 409.404208509883
b: 0.853441216192337
e: -22.9146558784191
c: 2.11844107695153
d: -413.987139685574

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by