Signal Processing Toolbox | ![]() ![]() |
Basic Shapes
The basic window is the rectangular window, a vector of ones of the appropriate length. A rectangular window of length 50 is
n = 50; w = boxcar(n);
This toolbox stores windows in column vectors by convention, so an equivalent expression is
w = ones(50,1);
The Bartlett (or triangular) window is the convolution of two rectangular windows. The functions bartlett
and triang
compute similar triangular windows, with three important differences. The bartlett
function always returns a window with two zeros on the ends of the sequence, so that for n
odd, the center section of bartlett(n+2)
is equivalent to triang(n)
.
bartlett(7) ans = 0 0.3333 0.6667 1.0000 0.6667 0.3333 0 triang(5) ans = 0.3333 0.6667 1.0000 0.6667 0.3333
For n
even, bartlett
is still the convolution of two rectangular sequences. There is no standard definition for the triangular window for n
even; the slopes of the line segments of the triang
result are slightly steeper than those of bartlett
in this case.
w = bartlett(8); [w(2:7) triang(6)] ans = 0.2857 0.1667 0.5714 0.5000 0.8571 0.8333 0.8571 0.8333 0.5714 0.5000 0.2857 0.1667
The final difference between the Bartlett and triangular windows is evident in the Fourier transforms of these functions. The Fourier transform of a Bartlett window is negative for n
even. The Fourier transform of a triangular window, however, is always nonnegative.
This difference can be important when choosing a window for some spectral estimation techniques, such as the Blackman-Tukey method. Blackman-Tukey forms the spectral estimate by calculating the Fourier transform of the autocorrelation sequence. The resulting estimate might be negative at some frequencies if the window's Fourier transform is negative (see Kay [1], pg. 80).
![]() | Windows | Generalized Cosine Windows | ![]() |