solving 5 nonlinear equations
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
piyu
am 9 Jul. 2017
Kommentiert: Alex Sha
am 20 Nov. 2024
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.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 9 Jul. 2017
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 Kommentare
Walter Roberson
am 10 Jul. 2017
Bearbeitet: Walter Roberson
am 10 Jul. 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.
Alex Sha
am 20 Nov. 2024
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu GPU Computing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!