MATLAB Answers

Root Finding problem in fsolve

8 views (last 30 days)
Atique Khan
Atique Khan on 12 Nov 2018
Edited: John D'Errico on 12 Nov 2018
I an trying to find roots of two nonlinear equations with defined range, at the run it gives the values as under and I wonder that why all values for x(1) and x(2) are zero
a, b, m, mt, x(1), x(2)
outputR =
-1.7000 1.0000 0.1324 3.8620 -0.0000 0.0000
-1.6000 1.0000 0.4595 3.4527 0.0000 0.0000
-1.5000 1.0000 0.6765 3.0763 0.0000 0.0000
-1.4000 1.0000 0.8063 2.7333 -0.0000 0.0000


Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 12 Nov 2018
Edited: John D'Errico on 12 Nov 2018
The crystal ball says: "You may have made a mistake"
Perhaps you want us to tell you which mistake you made? That is impossible to know.
1. Fsolve does not actually offer bound constraints, yet you say you used fsolve, and you supplied bound constraints. So it is tough to know what you actually did there.
2. Are there no solutions to be found in the given range, so some of the variables are forced to the limits you have tried to impose? How can we know?
3. Did you just supply terrible starting values, and had you done a better job, it might have found success? Who knows?
4. Did you call the code in some screwy incorrect way? Anything is possible, since you say you used fsolve, yet you said you had a defined range. Who knows?
5. Does your code have a bug in it, and was improperly written? Only da shadow know.
6. Are these indeed valid solutions to the problem? Remember that when you print out a number to only 4 digits in a fixed precision like that and see only zeros, that just means that the first 4 digits were zero. Come on Shadow! Tell us! Please?
Any and all of the above reasons might apply. Since we see now code, the only real resource is to ask the all knowing crystal ball, yet it seems unwilling to offer advice. Ok it did tell me that I (or is it talking about you?) may soon come into an inheritance from a distant relative, but that seems to be of little value here. I might suggest tarot cards next though.
Seriously, without seeing exactly what you did, any answer from those I listed as possibilities might apply. Attach your code, either as an attachment of an entire m-file to a comment or to your original question. Show what you did, how you called whichever optimizer you are really using. Finally, tell us the actual equations you are trying to solve. Don't force us to assume that you coded things properly, because how are we to know we can trust your coding skills?


Sign in to comment.




Community Treasure Hunt

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

Start Hunting!