A question of the function quadgk
12 次查看(过去 30 天)
显示 更早的评论
I recently use the function quadgk to solve the integration of a implicit function. However there is a warning"Reached the limit on the maximum number of intervals in use. Approximate bound on error is 4.0e+00. Increase MaxIntervalCount to 958 to enable QUADGK to continue for another iteration". I can not find the reason for this warning.please help me kindly. thanks very much
0 个评论
回答(1 个)
Walter Roberson
2016-7-18
According to the documentation,
'Reached the limit on the maximum number of intervals in use' indicates that the integration was terminated before meeting the tolerance requirements and that continuing the integration would require more than MaxIntervalCount subintervals. The integral may not exist, or it may be difficult to approximate numerically. Increasing MaxIntervalCount usually does not help unless the tolerance requirements were nearly met when the integration was previously terminated.
As indicated by the error message, you should add
'MaxIntervalCount', 958
to give it another try, but you should not be surprised if the integration fails again. "The integral may not exist, or it may be difficult to approximate numerically"
2 个评论
Walter Roberson
2016-7-18
... it may be difficult to approximate numerically.
Rewriting the integral might help.
For example if an integral involved exp(A)*exp(-B) then the exp(A) might overflow to inf and the exp(B) might underflow to 0, leaving a numeric mess, whereas exp(A-B) might be a perfectly comfortable computation.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!