lanczos: Create a Lanczos filter

Description Usage Arguments Value Examples

View source: R/lanczos.R

Description

Compute coefficients of a Lanczos filter

Usage

1
2
lanczos(n = 7, type = c("lp", "hp", "bp", "br"), low = 0,
  high = 0.5)

Arguments

n

length of filter; must be odd

type

one of "lp" (low pass), "hp" (high pass), "bp" (band pass) or "br" (band reject)

low

low frequency transition of "lp", "bp" and "br" filters (Nyquist = 0.5)

high

high frequency transition of "hp", "bp" and "br" filters (Nyquist = 0.5)

Value

non-negative time filter coefficients (filter is symmetric about 0).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# low-pass filter
lp <- lanczos( 7, "lp", low = 0.1 )

# high-pass filter
hp <- lanczos( 7, "hp", high = 0.4 )

# band-pass filter
bp <- lanczos( 7, "bp", low = 0.1, high = 0.4 )

# band-reject filter
br <- lanczos( 7, "br", low = 0.1, high = 0.4 )

plot( lp, xlab = "Index", ylab = "Filter Coefficients", type = "l", ylim = 1.5 * range( lp, hp, bp, br ) )
lines( hp, col = "red" )
lines( bp, col = "blue" )
lines( br, col = "green" )

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