Language Reference
TFWINDOW Function
TFWINDOW (len <, type> <, params> ) ;
This function is supported by the IML procedure and the iml action.
In signal processing, a window function is useful for smoothing spectra. The TFWINDOW function returns a window of a requested shape and length. For more information about the window functions that are implemented by the TFWINDOW function, see Harris (1978).
The input arguments are as follows:
- len
specifies the length of the window.
- type
specifies the type of the window to be created. The default is a HANNING window. The value of the type argument is case-insensitive, and you can abbreviate it. For the "Bartlett_Hahn" and "Blackman_Harris" windows, you must type the first nine characters. For all other windows, you must type at least the first four characters. For example, "Chebyshev" and "CHEB" specify the same window.
- params
specifies parameters to be used for creating windows. Not all windows require parameters. When params is missing, the default values of params are used.
The TFWINDOW function supports the following (case-insensitive) values for the type argument. In the following descriptions, N denotes the length of the window, and the N values that define a window are given by . Some windows need additional parameters.
- BARTLETT
-
specifies a Bartlett window, which does not require any parameters. This window function is defined as
- BARTLETT_HANN
-
specifies a Bartlett-Hann window, which does not require any parameters. This window function is defined as
- BLACKMAN
-
specifies a Blackman window, which does not require any parameters. This window is defined as
- BLACKMAN_HARRIS
-
specifies a Blackman-Harris window, which does not require any parameters. This window function is defined as
- BOHMAN
-
specifies a Bohman window, which does not require any parameters. This window function is defined as
- CHEBYSHEV
-
specifies a Chebyshev window, which requires one parameter, att, whose default value is 100. This window is defined in terms of the nth-degree Chebyshev polynomial,
, which is the unique polynomial such that
for all values of
.
can be computed as
For odd N (say,
) with
, the Chebyshev window of length N can be defined as
where
and c is chosen to make the largest term of w equal to 1.
For even N, the Chebyshev window of length N can be defined as
where c is chosen to make the largest term of w equal to 1.
- FLAT_TOP
-
specifies a flat-top window, which does not require any parameters. This window is function defined as
- GAUSSIAN
-
specifies a Gaussian window, which requires one parameter, c, whose default value is 2.5. This window function is defined as
- HAMMING
-
specifies a Hamming window, which does not require any parameters. This window function is defined as
- HANNING
-
specifies a Hanning window, which does not require any parameters. This window function is defined as
- KAISER
-
specifies a Kaiser window, which requires one parameter,
, whose default value is 0.5. This window function is defined as
where
is the modified Bessel function of the first kind of order 0, which is defined as
- PARZEN
-
specifies a Parzen window, which does not require any parameters. This window function is defined as
The last half of the window is defined by symmetry, which implies
for
.
- RECTANGULAR
-
specifies a rectangular window, which does not require any parameters. This window function is defined as
- TUKEY
-
specifies a Tukey window, which requires one parameter,
, whose default value is 0.5. Let
. If
, then a Hanning window is returned; if
, a rectangular window is returned. For
, this window function is defined as
The last half of the window is defined by symmetry.
The following statements demonstrate the TFWINDOW function by generating and plotting four different windows:
names = {"Bartlett" "Blackman" "Hanning" "Hamming"};
len = 11;
window = j(len, ncol(names));
do j = 1 to ncol(names);
window[,j] = tfwindow(len, names[j]);
end;
run WideToLong(t, w, winName,
window, , names);
title "Signal Processing Windows";
call series(t, w) group=winName grid={X Y};
Figure 474: Window Functions for Signal Processing
