integr: Signal integrator and differentiator.

Description Usage Arguments Details Value Examples

View source: R/filter.R

Description

Implements integrals and derivatives of sampled data using mvfft.

Usage

1
integr(x, p = 1, dt = NULL)

Arguments

x

Vector or matrix containing data to be integrated. If matrix, each column corresponds to a time series.

p

Order of integration. Negative integers represent derivatives.

dt

Time steps betweend samples. If not specified, x is assumed to be a time series ts object.

Details

Note that the function assumes that the signal has zero mean. The nonzer mean is not integrated.

Value

A vector The integral of the signal.

Examples

1
2
3
4
5
6
7
8
9
tt <- seq(0, 1, len=65)[1:64]
dt <- tt[2]
x <- ts(cos(2*pi*tt), start=0, deltat=dt)
dx <- integr(x, -1)
ix <- integr(x, 1)
plot(x, ylim=range(x, dx, ix))
lines(dx, lty=2)
lines(ix, lty=3)
legend(0, max(x,dx,ix), c("Signal", "Derivative", "Integral"), lty=1:3)

tunelipt/wutils documentation built on Nov. 5, 2019, 11:01 a.m.