MATLAB Function Reference    
quad, quad8

Numerically evaluate integral, adaptive Simpson quadrature

表示

詳細

q = quad(fun,a,b) tries to approximate the integral of function fun from a to b within roundoff error using recursive adaptive Simpson quadrature. fun accepts a vector x and returns a vector y, the function fun evaluated at each element of x.

Quadrature is a numerical method used to find the area under the graph of a function, that is, to compute a definite integral.

q = quad(fun,a,b,tol) uses an absolute error tolerance tol instead of the default which is where is the floating point accuracy eps and is an estimate at the integral. Larger values of tol result in fewer function evaluations and faster computation, but less accurate results. In MATLAB version 5.3 and earlier, the quad function used a less reliable algorithm and a default relative tolerance of 1.0e-3.

q = quad(fun,a,b,tol,trace) with non-zero trace shows the values of [fcnt a b-a Q] during the recursion.

q = quad(fun,a,b,tol,trace,p1,p2,...) provides for additional arguments p1,p2,... to be passed directly to function fun, fun(x,p1,p2,...). Pass empty matrices for tol or trace to use the default values.

例題

例題 1. You can specify fun three different ways:

例題 2. Integrate the sine function from 0 to :

参考

dblquad, inline, quadl, @ (function handle)

参考文献

Forsythe, G.E., M.A. Malcolm and C.B. Moler, Computer Methods for Mathematical Computations, Prentice-Hall, 1977.

Gander, W. and W. Gautschi, "Adaptive Quadrature - Revisited", BIT, Vol. 40, 2000, pp. 84-101. This document is also available at http://www.inf.ethz.ch/personal/gander.


 qrupdate quadl