How does fzero determine its tolerance?
显示 更早的评论
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?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Common Operations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!