trapz: Calculate the area under a sampled curve (or set of curves).

Description Usage Arguments Value Author(s) Examples

View source: R/bloodPerfusionSVD.R

Description

Given a vector (or a matrix) representing a curve (or set of curves, columnwise), the area (or set of areas) is calculated using the trapezoidal rule.

Usage

1
trapz(x, y)

Arguments

x

vector of samples for the dependent variable.

y

vector or matrix of samples for the independent variable. In the case of the latter, curves are organized column-wise.

Value

area (areas) under the sampled curve (curves).

Author(s)

Tustison NJ

Examples

1
2
3
4
5
x <- seq( 0, 1, by = 0.0001 )
y <- exp( x )

# Compare with true area of exp( 1 ) - 1 = 1.718282...
areaEstimate <- trapz( x, y )

neuroconductor-devel/ANTsR documentation built on April 1, 2021, 1:02 p.m.