MATLAB Answers

Integral2 warning: minRectSizePass

5 views (last 30 days)
Maria
Maria on 6 Aug 2020
Commented: Maria on 12 Aug 2020
Hi,
I am using the integral2, specifally the tiled integral, and I get this warning
Warning: Reached the minimum rectangle size. The result passes the global error test.
So the result passed the global error test. I assume that some local test was not passed...? I am not sure how to interprete this warning and, eventually, how to solve it. Does anyone know about it, or give me some reference?
Best

Accepted Answer

Uday Pradhan
Uday Pradhan on 12 Aug 2020
Edited: Uday Pradhan on 12 Aug 2020
Hi Maria,
The "integral2" function with the "tiled" method is an adaptive quadrature that transforms the integration region to a rectangle, including a transform that weakens edge singularities. In the transformed domain, the rectangle is subdivided into 4 equal rectangles, each of which may be subdivided into 4 equal rectangles if the error estimate for that part indicates the need, and so forth. It uses a tensor product Gauss-Kronrod rule on each rectangle to approximate the integral over that rectangle and to estimate the error.
This function uses the values of "AbsTol" and "RelTol" variables to estimate the desired accuracy of the integral calculated. You can set these values manually by entering them as name - value pairs in the following manner:
q = integral2(fun,a,b,c,d,'AbsTol',1e-4,'RelTol',1e-4);
Quoting from documentation of "integral2" :
The integral2 function attempts to satisfy:
abs(q - Q) <= max(AbsTol,RelTol*abs(q))
Hence, the warning that you see is caused possibly by the error limits being small enough that the refinement of the domain of integration by the algorithm reached its minimum step size (i.e. rectangular size in this case). You can get rid of this by setting custom tolerance values as mentioned above. Also, your function may have a singularity over the region of integration. The global test passed part suggests that the error tolerance limits were satisfied by all the refinements of the region over which you are integrating. Do keep in mind that this is a warning not an error, so the answer is still acceptable within the given tolerance levels.
To get a better idea of the inner algorithm, I suggest you try the quad2d function to calculate your integral which is similar to integral2d but also allows to plot the regions which fail the error tolerance tests. Please refer to the following links to get a better understanding of the ideas mentioned above : blog, integral2 algorithm.
  1 Comment
Maria
Maria on 12 Aug 2020
Thank you for the explanation! I will take a look at the quad2d. The last link looks very promising! Thanks again!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by