quadv
Numerical integration of a real vector-valued function using adaptive Simpson's rule.
Syntax
area=quadv(@func,a,b)
area=quadv(@func,a,b,abstol)
[area,count]=quadv(...)
Inputs
- func
- The function to integrate.
- a
- Lower integration limit.
- b
- Upper integration limit.
- abstol
- Absolute tolerance (default: sqrt(eps) or about 1.0e-8).
Outputs
- area
- The estimated area.
- count
- Number of function evaluations.
Example
function y = Integrand(x)
y(1) = 13 * (x - x^2) * exp(-3*x/2);
y(2) = log(1 + x);
end
[area,count] = quadv(@Integrand, 0, 4, 1.0e-5)
-1.54879 4.04719
count = 69Comments
quadv recursively bisects each interval until the improvement falls below the absolute tolerance. Intervals are assumed to have finite bounds.
The maximum number of function evaluations is 10,000, and the minimum interval is 1.0e-12.
To pass additional parameters to a function argument, use an anonymous function.