cderiv {BayesfMRI}R Documentation

Central derivative

Description

Take the central derivative of numeric vectors by averaging the forward and backward differences.

Usage

cderiv(x)

Arguments

x

A numeric matrix, or a vector which will be converted to a single-column matrix.

Value

A matrix or vector the same dimensions as x, with the derivative taken for each column of x. The first and last rows may need to be deleted, depending on the application.

Examples

x <- cderiv(seq(5))
stopifnot(all(x == c(.5, 1, 1, 1, .5)))


[Package BayesfMRI version 0.3.11 Index]