dblquad
Numerical double integral over a rectangle (older interface).
Category: Mathematics > Numerical Integration and Differential Equations
Syntax
q = dblquad(fun, xmin, xmax, ymin, ymax)
Integrates fun(x, y) over the rectangle.
q = dblquad(fun, xmin, xmax, ymin, ymax, tol)
Uses the absolute tolerance tol.
Description
dblquad is retained for compatibility; new code should prefer integral2, which is more accurate and supports non-rectangular regions and infinite limits.
Write the integrand with element-wise operators (.*, .^), because it is called with a vector in x.
Input arguments
fun- Handle accepting a vector
xand a scalary, returning a vector of values. xmin, xmax, ymin, ymax- Finite limits of the rectangle.
tol- Absolute tolerance. Default
1e-6.
Output arguments
q- Approximate value of the integral.
Example
Integral of x*y on the unit square
dblquad(@(x, y) x.*y, 0, 1, 0, 1)
Output
ans = 0.2500