tukeywin {gsignal} | R Documentation |
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 |
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)