I have a system of nonlinear equations with 6 different variables. I tried to use fsolve in order to get the solution, but first of all the answer must be positive, but i got the negetive answer. On the other hand when i want to test the answers it does not satisfy the equations. what may be the problem? f1 =x1 + x3 + x5 - 1
f2 =2*x1 + 2*x4 + 4*x5 - 97/51
f3 =x2 + 2*x3 + x4 - 2*x6 - 11893/10200
f4 =x2*x3 - (1003*x1*x4)/1000
f5 =x5 - (124*x2^2)/125
f6 =(1048753048193283741*x2)/70368744177664 - (6654018600221532327*x1)/70368744177664 - 393509*x3 - 285830*x4 - (10780477*x5)/250 - (506682419*x6)/3125 - 119037031313010039444557/219902325555200000

 Accepted Answer

Roger Stafford
Roger Stafford on 7 Feb 2015
I would suggest you temporarily disregard the equation with f4 and regard x2 as a known parameter. That leaves you with five linear equations in the five unknowns x1, x3, x4, x5, and x6. You can obtain explicit solutions for these five variables in terms of the parameter x2, either using 'solve' or Cramer's rule. Then substitute these expressions for x1, x3, and x4 in the equation for f4 = 0 which will give you a single equation in terms of the single unknown x2 for which you can use 'fzero' in solving it. That should be much easier than using 'fsolve' with six unknowns. You can even do a plot in advance to discover the approximate roots for x2 to use for one or more initial estimates in 'fzero'. Then use your five expressions above to find the corresponding values of the other five unknowns.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!