How does fzero determine its tolerance?
Show older comments
In the fzero function, according to the help, it is possible to specify a TolX parameter (higher TolX value means less function calls, which in my situation will greatly reduce computation time). I assume this tolerance is the maximum allowed difference between the calculated root and the real root, but as following example shows this apparently not true.
options = optimset('TolX',0.01);
x0 = fzero(@cos,[0.1 3],options); % exact solution of cos(x)=0 is 0.5*pi
errorx = x0 - 0.5*pi % answer is 0.0139 (which is bigger than the tolerance of 0.01)
Note that in this simplified example the error is only slightly bigger than the tolerance, but in my own code the error was more than 10x bigger than the tolerance.
So my question is, what does the TolX parameter do?
How can I specify a maximum error on the result of fzero?
Accepted Answer
More Answers (0)
Categories
Find more on Common Operations 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!