Description Usage Arguments Details Value Note Author(s) References See Also Examples
Computes the integral of Y with respect to X using trapezoid rule integration.
1 | trapz(x, y)
|
x |
Sorted vector of x-axis values. |
y |
Vector of y-axis values. |
The function has only two lines:
1 2 3 |
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.
Jarek Tuszynski (SAIC) jaroslaw.w.tuszynski@saic.com
D. Kincaid & W. Chaney (1991), Numerical Analysis, p.445
integrate
Matlab's trapz
function (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/trapz.html)
1 2 3 4 5 6 7 |
[1] 1.934983
[1] 1.999993
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.