A question of the function quadgk

12 views (last 30 days)
Mathis
Mathis on 18 Jul 2016
Commented: Walter Roberson on 18 Jul 2016
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

Answers (1)

Walter Roberson
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
Mathis
Mathis on 18 Jul 2016
Thank you for you quick answer. The integral for my question do exist in theory.What are the others factors that may lead to this problem?
Walter Roberson
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.

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!