sm_auc {smplot2} | R Documentation |
Calculation of the Area under a Curve (Trapezoidal numerical integration)
Description
This is equivalent to Matlab's trapz function.
Usage
sm_auc(x, y)
Arguments
x |
This is the scalar spacing of the coordinate. When the argument for 'x' is not provided, it will calculates the approximate integral value for ‘Y’ with unit spacing based on the length of ‘y’. |
y |
Numerical data. The length of x and y must be equal. |
Value
A vector that is the value from the trapezoidal integration is returned.
Examples
library(smplot2)
X = c(1,2,3,4,5)
Y1 = c(2,3,4,2,3)
Y2 = c(3,3,3,3,3)
sm_auc(X,Y2)
sm_auc(X,Y1)
[Package smplot2 version 0.2.4 Index]