quadv will be removed in a future release.
integral with the
Q = quadv(fun,a,b)
Q = quadv(fun,a,b,tol)
Q = quadv(fun,a,b,tol,trace)
[Q,fcnt] = quadv(...)
Q = quadv(fun,a,b) approximates the integral
of the complex array-valued function
within an error of
1.e-6 using recursive adaptive
fun is a function handle.
Y = fun(x) should
accept a scalar argument
x and return an array
Y, whose components are the integrands evaluated
Parameterizing Functions explains how to provide addition
parameters to the function
fun, if necessary.
Q = quadv(fun,a,b,tol) uses the absolute
tol for all the integrals instead
of the default, which is
The same tolerance is used for all components, so the results
quadv are usually not the same as
those obtained with
quad on the individual components.
Q = quadv(fun,a,b,tol,trace) with non-zero
the values of
[fcnt a b-a Q(1)] during
[Q,fcnt] = quadv(...) returns the number
of function evaluations.
The list below contains information to help you determine which quadrature function in MATLAB® to use:
quad function might be most
efficient for low accuracies with nonsmooth integrands.
quadl function might be more
quad at higher accuracies with
quadgk function might be
most efficient for high accuracies and oscillatory integrands. It
supports infinite intervals and can handle moderate singularities
at the endpoints. It also supports contour integration along piecewise
quadv function vectorizes
If the interval is infinite, ,
then for the integral of
fun(x) to exist,
x approaches infinity, and
it to decay rapidly. Special methods should be used for oscillatory
functions on infinite intervals, but
be used if
fun(x) decays fast enough.
quadgk function will integrate
functions that are singular at finite endpoints if the singularities
are not too strong. For example, it will integrate functions that
behave at an endpoint
>= -1/2. If the function is singular at points inside
write the integral as a sum of integrals over subintervals with the
singular points as endpoints, compute them with
and add the results.
For the parameterized array-valued function
function Y = myarrayfun(x,n) Y = 1./((1:n)+x);
the following command integrates
for the parameter value n = 10 between
a = 0 and b = 1:
Qv = quadv(@(x)myarrayfun(x,10),0,1);
The resulting array
Qv has 10 elements estimating
= log((k+1)./(k)), for
k = 1:10.
The entries in
Qv are slightly different
than if you compute the integrals using
for k = 1:10 Qs(k) = quadv(@(x)myscalarfun(x,k),0,1); end
function y = myscalarfun(x,k) y = 1./(k+x);