dderiv {rchemo} | R Documentation |
Derivation by finite difference
Description
Calculation of the first derivatives, by finite differences, of the row observations (e.g. spectra) of a dataset.
Usage
dderiv(X, n = 5, ts = 1)
Arguments
X |
X-data ( |
n |
The number of points (i.e. columns of |
ts |
A scaling factor for the finite differences (by default, |
Value
A matrix of the transformed data.
Examples
data(cassav)
X <- cassav$Xtest
n <- 15
Xp_derivate1 <- dderiv(X, n = n)
Xp_derivate2 <- dderiv(dderiv(X, n), n)
oldpar <- par(mfrow = c(1, 1))
par(mfrow = c(1, 2))
plotsp(X, main = "Signal")
plotsp(Xp_derivate1, main = "Corrected signal")
abline(h = 0, lty = 2, col = "grey")
par(oldpar)
[Package rchemo version 0.1-2 Index]