# Windows Introduction.

Cuthbert Nyack
Because of the truncation of the impulse response, FIR filters have very limited attenuation in the stop band. This effect can be reduced by reducing the values of the impulse response near the truncated values. This process is known as windowing and by reducing the discontinuity in the impulse response at the ends, it reduces the high frequencies needed to reconstruct this discontinuity.

The result is an increase in stop band attenuation. However this occurs at a price. A necessary consequence of the windowing process is a contraction of the signal in the time domain and because of the inverse relationship between time and frequency, this results in a broadening of the frequency spectrum which shows up as an increase in the bandwidth of the transition region between the pass and stop bands.

Some of the windows which can be used are:-
Triangle window w(t) = 1 - 2|t|/t for |t| <=t/2.
Hamming window w(t) = 0.54 + 0.46 * cos(2pt/t) for |t| <=t/2.
Hanning window w(t) = 0.50 + 0.50 * cos(2pt/t) for |t| <=t/2.
Blackman window w(t) = 0.42 + 0.5 * cos(2pt/t) + 0.08 * cos(4pt/t) for |t| <=t/2. and its relative the Blackman Harris window.
Kaiser window w(t) = Io [q(1 - (2t/t)2)n] /Io(q) for |t| <=t/2.
The power n is normally taken as 0.5 but in most of the applets here n is treated as a variable.
q is a variable parameter for the Kaiser window and increasing q increases the stop band attenuation but with some broadening of the transition region.
Filters comparable to those derived with the Kaiser window can be derived with the Chebychev window. Unfortunately there is no analytical expression for this window since it is specified as the IDFT of combinations of Chebychev functions.
Although the equiripple or optimal approach to designing FIR filters is considered by some to be the best, FIR filters using the Kaiser window are much easier to arrive at and can be close to optimal.

The effect of a window on the impulse response is illustrated by the applet below.
The window used to modify the impulse response is shown in dark green and can be varied by Fn to be a rectri, Hamming, Hanning, Blackman or Kaiser window. For Fn = 0 the window can be varied between a rectangle and a triangle by varying the parameter a. When Fn = 4 the Kaiser window can be varied by the parameter q/p. When q/p = 2.74 the Kaiser window is almost identical to the Blackman window. When q/p = 0.0 the Kaiser window is identical to the Rectangular window.
fc/fs determines the impulse response and the number of terms in the impulse response used to calculate the frequency response is N. N is referred to as the length of the filter or the number of taps. The triangular part of the window can be reshaped by the parameter p. Values of the impulse response where the window is rectangular are unaffected while those where the window is a triangle are reduced.

Plots of the Hamming, Hanning, Blackman and Kaiser windows are shown at the bottom of the applet. Numerical values of the impulse response and window function for the rectangular, rectri, Hamming, Hanning and Blackman windows can be obtained by changing the parameter nI.

The impulse response without a window is shown in pink and the response after windowing is shown in cyan.
eg parameters(31, 0.05, 0.5, 1.0, 2.0, NA, NA, 0, NA, 2)
Values of the impulse response near both ends have been compressed and the sharp transition at the truncation points eliminated.

In these pages the effect of windows on the frequency response is illustrated. These include useful windows as the Hamming, Hanning, Blackman, Blackman-Harris, Kaiser and Dolph-Chebychev windows as well as interesting but not necessarily useful widows such as the triangle, cosine, exponential and polynomial windows.