Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tukeywin

Tukey (tapered cosine) window


Description

Return the filter coefficients of a Tukey window (also known as the cosine-tapered window) of length n.

Usage

tukeywin(n, r = 1/2)

Arguments

n

Window length, specified as a positive integer.

r

Cosine fraction, specified as a real scalar. The Tukey window is a rectangular window with the first and last r / 2 percent of the samples equal to parts of a cosine. For example, setting r = 0.5 (default) produces a Tukey window where 1/2 of the entire window length consists of segments of a phase-shifted cosine with period 2r = 1. If you specify r <= 0, an n-point rectangular window is returned. If you specify r >= 1, an n-point von Hann window is returned.

Details

The Tukey window, also known as the tapered cosine window, can be regarded as a cosine lobe that is convolved with a rectangular window. r defines the ratio between the constant section and and the cosine section. It has to be between 0 and 1. The function returns a Hann window for r equal to 1 and a rectangular window for r equal to 0.

Value

Tukey window, returned as a vector.

Author(s)

Laurent Mazet, mazet@crm.mot.com.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.

Examples

n <- 128
t0 <- tukeywin(n, 0)        # Equivalent to a rectangular window
t25 <- tukeywin(n, 0.25)
t5 <- tukeywin(n)           # default r = 0.5
t75 <- tukeywin(n, 0.75)
t1 <- tukeywin(n, 1)         # Equivalent to a Hann window
plot(t0, type = "l", xlab = "Samples", ylab =" Amplitude", ylim=c(0,1.2))
lines(t25, col = 2)
lines(t5, col = 3)
lines(t75, col = 4)
lines(t1, col = 5)

gsignal

Signal Processing

v0.3-1
GPL-3
Authors
Geert van Boxtel [aut, cre] (Maintainer), Tom Short [aut] (Author of 'signal' package), Paul Kienzle [aut] (Majority of the original sources), Ben Abbott [ctb], Juan Aguado [ctb], Muthiah Annamalai [ctb], Leonardo Araujo [ctb], William Asquith [ctb], David Bateman [ctb], David Billinghurst [ctb], Juan Pablo Carbajal [ctb], André Carezia [ctb], Vincent Cautaerts [ctb], Eric Chassande-Mottin [ctb], Luca Citi [ctb], Dave Cogdell [ctb], Carlo de Falco [ctb], Carne Draug [ctb], Pascal Dupuis [ctb], John W. Eaton [ctb], R.G.H Eschauzier [ctb], Andrew Fitting [ctb], Alan J. Greenberger [ctb], Mike Gross [ctb], Daniel Gunyan [ctb], Kai Habel [ctb], Kurt Hornik [ctb], Jake Janovetz [ctb], Alexander Klein [ctb], Peter V. Lanspeary [ctb], Bill Lash [ctb], Friedrich Leissh [ctb], Laurent S. Mazet [ctb], Mike Miller [ctb], Petr Mikulik [ctb], Paolo Neis [ctb], Georgios Ouzounis [ctb], Sylvain Pelissier [ctb], Francesco Potortì [ctb], Charles Praplan [ctb], Lukas F. Reichlin [ctb], Tony Richardson [ctb], Asbjorn Sabo [ctb], Thomas Sailer [ctb], Rolf Schirmacher [ctb], Rolf Schirmacher [ctb], Ivan Selesnick [ctb], Julius O. Smith III [ctb], Peter L. Soendergaard [ctb], Quentin Spencer [ctb], Doug Stewart [ctb], P. Sudeepam [ctb], Stefan van der Walt [ctb], Andreas Weber [ctb], P. Sudeepam [ctb], Andreas Weingessel [ctb]
Initial release
2021-05-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.