windowing: Windowing functions

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

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

Usage

1
2
3
4
5
6
7
8
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

Example output

Attaching package: 'signal'

The following objects are masked from 'package:stats':

    filter, poly

signal documentation built on May 25, 2021, 9:06 a.m.

Related to windowing in signal...