trapz.Rd
Computes the integral of Y with respect to X using trapezoid rule integration.
trapz(x, y)
The function has only two lines:
Integral of Y with respect to X or area under the Y curve.
Trapezoid rule is not the most accurate way of calculating integrals (it is exact for linear functions), for example Simpson's rule (exact for linear and quadratic functions) is more accurate.
D. Kincaid & W. Chaney (1991), Numerical Analysis, p.445
Matlab's trapz
function (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/trapz.html)