A question of the function quadgk
11 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Walter Roberson
on 18 Jul 2016
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 Comments
Walter Roberson
on 18 Jul 2016
... 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.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!