Main Content

tukeywin

Tukey (tapered cosine) window

Description

w = tukeywin(L,r) returns an L-point Tukey window with cosine fraction r.

example

Examples

collapse all

Compute 128-point Tukey windows with five different values of r, or "tapers." Display the results using wvtool.

L = 128;
t0 = tukeywin(L,0);        % Equivalent to a rectangular window
t25 = tukeywin(L,0.25);
t5 = tukeywin(L);          % r = 0.5
t75 = tukeywin(L,0.75);
t1 = tukeywin(L,1);        % Equivalent to a Hann window
wvtool(t0,t25,t5,t75,t1)

Figure Window Visualization Tool contains 2 axes objects and other objects of type uimenu, uitoolbar, uipanel. Axes object 1 with title Time domain, xlabel Samples, ylabel Amplitude contains 5 objects of type line. Axes object 2 with title Frequency domain, xlabel Normalized Frequency (\times\pi rad/sample), ylabel Magnitude (dB) contains 5 objects of type line.

Input Arguments

collapse all

Window length, specified as a positive integer.

Note

If you specify L as noninteger, the function rounds it to the nearest integer value.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

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 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 L-point rectangular window is returned. If you specify r ≥ 1, an L-point von Hann window is returned.

Data Types: single | double

Output Arguments

collapse all

Tukey window, returned as a column vector.

Algorithms

The following equation defines the L-point Tukey window:

w(x)={12{1+cos(2πr[xr/2])},0x<r21,r2x<1r212{1+cos(2πr[x1+r/2])},1r2x1

where x is an L-point linearly spaced vector generated using linspace. The parameter r is the ratio of cosine-tapered section length to the entire window length with 0 ≤ r ≤ 1. For example, setting r = 0.5 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 L-point rectangular window is returned. If you specify r ≥ 1, an L-point von Hann window is returned.

References

[1] Bloomfield, P. Fourier Analysis of Time Series: An Introduction. New York: Wiley-Interscience, 2000.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a

See Also

Apps

Functions