how get the solution of three nonlinear equation and three unknowns on MATLAB?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (3개)
Walter Roberson
2017년 11월 11일
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()
Roger Stafford
2017년 11월 11일
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.
댓글 수: 3
Roger Stafford
2017년 11월 11일
You have my sympathy.
I should have said that the advantage of having a single equation in a single unknown is that you can easily plot the expression as z varies over the range you are interested in and you can see where the expression in z crosses the zero values. That can greatly speed up the action of ‘fzero’ if these crossing values of z are used as “starting” values in ‘fzero’.
Gamal Zayed
2020년 1월 25일
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?
댓글 수: 1
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!