Fzero Exit Inf Value NaN
15 views (last 30 days)
Show older comments
I am using the fzero function and at some points get the error:
Exiting fzero: aborting search for an interval containing a sign change because NaN or Inf function value encountered during search.
(Function value at -1.3492 is Inf.)
Check function or try again with a different starting value.
ans = NaN
Which looking at the matrix of values seems to be caused by where the function goes off to infinity so cannot find f=0 value as there is not one.
How can I resolve this problem? There is a little bit of code I can add in to get around this? At the moment those points on the contour plot are just white but expect to have something there.
Answers (1)
Matt J
on 21 Jun 2013
Edited: Matt J
on 21 Jun 2013
as there is not one.
You seem to be saying here that the function has no root. If so, why is it a problem if the search fails? It is correctly telling you that no solution exists.
On the other hand, if you think FZERO is just searching in the wrong region, then the syntax
fzero(fun,[lb,ub])
will limit the search to the interval [lb,ub]
0 Comments
See Also
Categories
Find more on Historical Contests in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!