Clear Filters
Clear Filters

i want to solve 3 non linear equations in matlab

3 views (last 30 days)
eq1= 72.25+23.29*x-25.79*y-6.592*x*y-27.98*y^2-7.255*x*y^2+6.918*y^3-e1 =0;
eq2= 46.99+15.46*x+9.358*y+0.6696*x*y-19.9*y^2-5.869*x*y^2-4.47*y^3-e2=0;
eq3= 20.22+6.611*x+12.02*y+2.7*x*y-6.497*y^2-2.425*x*y^2-4.529*y^3-e3 =0 ;
I gave 3 non linear equations above and I want to find solution of x and y . e1 e2 e3 let e1 e2 e3 are unknown constants .I want the solution x and y must be in terms or fuction of e1,e2,e3 . So I want a program in matlab with solution as soon as possible.

Answers (3)

Joshua Levin Kurniawan
Joshua Levin Kurniawan on 28 Apr 2024
Hello, you can use the following code
syms x y e1 e2 e3
eq1 = 72.25 + 23.29*x - 25.79*y - 6.592*x*y - 27.98*y^2 - 7.255*x*y^2 + 6.918*y^3 - e1;
eq2 = 46.99 + 15.46*x + 9.358*y + 0.6696*x*y - 19.9*y^2 - 5.869*x*y^2 - 4.47*y^3 - e2;
eq3 = 20.22 + 6.611*x + 12.02*y + 2.7*x*y - 6.497*y^2 - 2.425*x*y^2 - 4.529*y^3 - e3;
sol = solve([eq1, eq2, eq3], [x, y]);
disp(sol);

Torsten
Torsten on 28 Apr 2024
Moved: Torsten on 28 Apr 2024
You have three equations and two unknowns. Usually, such systems don't have a solution.
And even if there were two equations in two unknowns: it will most probably not be possible to solve systems of cubic equations with unspecified parameters e1, e2 and e3 and symbolic math.

John D'Errico
John D'Errico on 28 Apr 2024
Edited: John D'Errico on 28 Apr 2024
You can want anything you want. I, for example, want to see peace in the world, with everyone treating everyone else as an equal, who equally deserves to live a happy life. Yeah, right. Gonna happen. Just wanting something is not enough for it to ever happen. And you want it as soon as possible. No problem. I'll rush right to it.
Look carefully at your equations. UNDERSTAND WHAT THEY MEAN.
syms x y e1 e2 e3
eq1= 72.25+23.29*x-25.79*y-6.592*x*y-27.98*y^2-7.255*x*y^2+6.918*y^3-e1 == 0;
eq2= 46.99+15.46*x+9.358*y+0.6696*x*y-19.9*y^2-5.869*x*y^2-4.47*y^3-e2 == 0;
eq3= 20.22+6.611*x+12.02*y+2.7*x*y-6.497*y^2-2.425*x*y^2-4.529*y^3-e3 == 0;
We can arbitrarily start with eq1, solving for x.
xiso = solve(eq1,x)
xiso = 
Disregarding the case where that could produce a divide by zero... Now we could substitute x into BOTH of equations 2 and 3.
subs(eq2,x,xiso)
ans = 
I won't do eq3 here, as it would be just another terrible mess to look at, and would gain nothing. This would require both of those equations to be true at once. Effectively, if we clear out the denominators in the above result, we would have something that looks like a general 6th degree polynomial equation in y. And of course, there is no solution for that general problem anyway. (That goes way back to Abel-Ruffini.) But even if we COULD do that, we would have TWO such problems, each of them degree 6 polynomials in y, both of which must be true at once.
You have a problem that is both unsolvable in terms of algebra, and unsolvable because it is over-determined. You have insufficient degrees of freedom to solve three equations in two unknowns.

Tags

Products


Release

R2015a

Community Treasure Hunt

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

Start Hunting!