# how get the solution of three nonlinear equation and three unknowns on MATLAB?

35 views (last 30 days)
Emma on 11 Nov 2017
Commented: Walter Roberson on 26 Jan 2020
I have three non-linear equation and three unknowns. This equation are complex and have decimal number for coefficients and power. exactly I have this equation:
0.0425*x*z^-2-0.7*x-0.00253*x*z+0.00134*x*z^2-0.03*x*z^1.7+0.0063*x*z^3.4-0.1*x*z^0.07+0.00047*x*z^2.7+0.18*y*z^-2-0.865*y-0.013*y*z+0.0002*y*z^2-0.03*y*z^1.7+0.0019*y*z^3.4-0.5*y*z^0.7+0.00023*y*z^2.7==0
80.4+3*z^-1-14*z+0.25*z^2-0.01*z^3+0.11*z^2.7+11.4*z^1.7-0.0098*z^3.7-0.0078*z^4.4-20*x+2000==0
123.6-5.4*z^-1-19.2*z-0.198*z^2+0.00024*z^3-0.3*z^2.7-0.84*z^1.7+0.0183*z^3.7-0.006*z^3.4+0.012*z^4.4-16.6666*y+1333.3333==0
So how can I solve it?
thanks

Walter Roberson on 11 Nov 2017
syms x y z
eqn = [0.0425*x*z^-2-0.7*x-0.00253*x*z+0.00134*x*z^2-0.03*x*z^1.7+0.0063*x*z^3.4-0.1*x*z^0.07+0.00047*x*z^2.7+0.18*y*z^-2-0.865*y-0.013*y*z+0.0002*y*z^2-0.03*y*z^1.7+0.0019*y*z^3.4-0.5*y*z^0.7+0.00023*y*z^2.7==0
80.4+3*z^-1-14*z+0.25*z^2-0.01*z^3+0.11*z^2.7+11.4*z^1.7-0.0098*z^3.7-0.0078*z^4.4-20*x+2000==0
123.6-5.4*z^-1-19.2*z-0.198*z^2+0.00024*z^3-0.3*z^2.7-0.84*z^1.7+0.0183*z^3.7-0.006*z^3.4+0.012*z^4.4-16.6666*y+1333.3333==0 ];
solve(eqn)
and wait, and wait, and wait.... Hope you have a lot of memory.
Your question has obvious 4th powers of z, and has decimal exponents such as ^1.7 and ^4.4 . If you are looking for all solutions in exact closed-form representation then you are going to have over 400 complex roots when the solution is eventually found, after the decimal exponents are rewritten in rational form.
If you just want one solution, in decimal form, then above use vpasolve() instead of solve()
Emma on 11 Nov 2017
so thanks but you said "and wait, and wait ..."; how long does it take? half day?
for vpasolve, I face on this error "Undefined function or method 'vpasolve' for input arguments of type 'char'."

Roger Stafford on 11 Nov 2017
In the second equation you can easily, by hand, solve for x in terms of z. In the third equation you can do likewise with y in terms of z. In the first equation you can factor x out of the first eight terms and y out of the remaining eight terms. Finally, in the resulting expression you can substitute the two expressions for x and y you obtained from the second and third equations, into this first equation expression. That gives you a single equation entirely in terms of the single unknown, z. You can use ‘fzero’ to solve it numerically. Then you can use those second and third equations' expressions to evaluate the corresponding values of x and y.
However, if all that seems like too much manual labor, you can use ‘fsolve’ for the original set of equations. Note that for either method you will have to furnish starting values for the process to use in its iterative method.
Emma on 11 Nov 2017
Appreciate that

Gamal Zayed on 25 Jan 2020
Really thanks. I tried fsolve with many initial points and found two things: 1) choosing too far initial values gave me minimum errors! 2) Matlab recommended for me using Levenberg-Marquardt algorithm because it’s better solving non-square equations! Another issue is related to trust region! I am studying this algorithm, but it is curve fitting for m-empirical points. Where my case is finding the values of 3 unknowns in 3 non-linear equations. Can you help me please?
Walter Roberson on 26 Jan 2020
Trust-region Reflective is not only used for curve fitting.