Is there any function other than Fsolve to solve systems of nonlinear equations ????
3 views (last 30 days)
Show older comments
I am trying to solve the following system of 3 nonlinear equations:
XYZ(1)-A*(B*XYZ(2)^P1-C*XYZ(2)^P2)^(1/2)=0
XYZ(1)*F+G-XYZ(1)*XYZ(3)*H-I*XYZ(3)=0
XYZ(1)+E-D*XYZ(2)*XYZ(3)^(-1/2)=0
Where A,B,C,D,E,F,G,H,I,P1 and P2 are variables and X,Y and Z are the 3 unknowns to find.
I have tried using the function Fsolve with an m-file but the results were not good enough.
Is there any other function to solve this system ?????
3 Comments
Walter Roberson
on 6 May 2012
Do not post duplicate questions: doing so leads to duplicated efforts, and to confusion and resentment in the volunteers who answer questions, and leads to extra work for the editors who have to merge the copies of the questions together.
Answers (3)
Taniadi
on 3 May 2012
I agree with Friedrich, to test, you can see the value of your equations using: [yout, fval ] = fsolve('function',guess). where fval is the value of your function. If it is small enough near zero, fsolve is good.
another way maybe is to write another M-file using another numerical method. I don't know if there is another function in MATLAB for solving system of nonlinear eqs other than fsolve.
2 Comments
Walter Roberson
on 6 May 2012
So add a couple of lines to the Function block to cross-check the accuracy of the result. Display the results to the command window if you need to.
Sargondjani
on 7 May 2012
the problem certainly has not converged as y is still jumping up and down, so there is some problem...
for a start, you should supply the Jacobian, because that will help the problem to converge
second: are you sure that there is only one unique solution to the problem??
0 Comments
Walter Roberson
on 7 May 2012
Maple believes there is no solution to those equations. If you could supply specific test values for each of the variables, I could try again.
6 Comments
Walter Roberson
on 9 May 2012
Simulation 1: you run into round-off problems that prevent you from finding an exact solution. To 10 digits, the solution is
X = 35.44161536, Y = 68798.38215, Z = 622.0811574
Simulation 2: you run into much worse round-off problems. To 10 digits the solution is
X = 49.36060688, Y = 1.359808683*10^5, Z = 1182.292856
I think about the most efficient way to handle this is to solve the last two equations for X and Y (yielding X and Y expressed entirely in terms of Z), and substituting those in to the first equation, yielding an expression in Z that must be equal to 0. You can then do a one-dimensional solver. You do need to be careful, though, as the expression goes imaginary below around 570, and again above around 5E8. The upper bound is easy to find, but the lower bound is tricky to establish; there is a first-order lower bound around 270 that is much easier to establish (values below the first-order lower-bound are certain to be imaginary; the actual lower bound depends on the fine balancing of exponentials.)
The expression to solve one-dimensionally in Z comes out as
(-A*(F-Z*H)*(B*(((I-E*H)*Z-G+E*F)*Z^(1/2)/(D*(F-Z*H)))^P1-C*(((I-E*H)*Z-G+E*F)*Z^(1/2)/(D*(F-Z*H)))^P2)^(1/2)-G+I*Z)/(F-Z*H)
Do be careful in the use of "I" as symbolic packages tend to treat "I" as the imaginary constant.
See Also
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!