Windowing functions {signal}R Documentation

Windowing functions

Description

A variety of generally Matlab/Octave compatible filter generation functions, including Bartlett, Blackman, Hamming, Hanning, and triangular.

Usage

bartlett(n) 
blackman(n) 
boxcar(n) 
flattopwin(n, sym = c('symmetric', 'periodic')) 
gausswin(n, w = 2.5) 
hamming(n) 
hanning(n) 
triang(n)

Arguments

n

length of the filter; number of coefficients to generate.

w

the reciprocal of the standard deviation for gausswin. Use larger a for a narrower window.

sym

'symmetric' for a symmetric window, 'periodic' for a periodic window.

Details

triang, unlike the bartlett window, does not go to zero at the edges of the window. For odd n, triang(n) is equal to bartlett(n+2) except for the zeros at the edges of the window.

A main use of flattopwin is for calibration, due to its negligible amplitude errors. This window has low pass-band ripple, but high bandwidth.

Value

Filter coefficients.

Author(s)

Original Octave versions by Paul Kienzle (boxcar, gausswin, triang) and Andreas Weingessel (bartlett, blackman, hamming, hanning). Conversion to R by Tom Short.

References

Oppenheim, A.V., and Schafer, R.W., Discrete-Time Signal Processing, Upper Saddle River, NJ: Prentice-Hall, 1999.

Gade, S., Herlufsen, H. (1987) “Use of weighting functions in DFT/FFT analysis (Part I)”, Bruel & Kjaer Technical Review No. 3.

https://en.wikipedia.org/wiki/Windowed_frame

Octave Forge https://octave.sourceforge.io/

See Also

filter, fftfilt, filtfilt, fir1

Examples

n <- 51
op <- par(mfrow = c(3,3))
plot(bartlett(n), type = "l", ylim = c(0,1))
plot(blackman(n), type = "l", ylim = c(0,1))
plot(boxcar(n), type = "l", ylim = c(0,1))
plot(flattopwin(n), type = "l", ylim = c(0,1))
plot(gausswin(n, 5), type = "l", ylim = c(0,1))
plot(hanning(n), type = "l", ylim = c(0,1))
plot(hamming(n), type = "l", ylim = c(0,1))
plot(triang(n), type = "l", ylim = c(0,1))
par(op)

[Package signal version 1.8-1 Index]