fdfilter: Finite difference stencil filter

Description Usage Arguments Value Examples

View source: R/fdfilter.R

Description

Compute a finite-difference "stencil" for numerical differentiation

Usage

1
fdfilter(n = 3, d = 1)

Arguments

n

total length of filter. 3 <= n < 19 and odd.

d

order of the derivative. Must be an integer and satisfy 1 <= d < n

Value

Derivative filter coefficients. Use filter two-sided filter.

Examples

1
2
3
4
5
6
7
8
f <- fdfilter( 5, 1 )
time <- 1:100
period <- 20
phase <- 2 * pi * time / period
s <- sin( phase )
Ds <- stats::filter( s, f )
plot( Ds, type = "l" )
lines( 2 * pi / period * cos( phase ), col = "red" )

jrevenaugh/TSAUMN documentation built on Nov. 8, 2019, 2:20 p.m.