# What is a window function in DSP and why do we need it?

When designing digital filters we start off with FIR and IIR. Later on we talk about window functions e.g Kaiser and Hamming windows.

I do not understand why we need so many type of window functions described by rather complex mathematical equations and how they relate to FIR and IIR.

First you need to understand that windows, such as the Kaiser or Hanning, are used to design FIR filters, not IIR. Windows are also used for spectral analysis, but I think you are only asking about them with regard to filter design.

The reason there are so many types of windows is that each generates a slightly different frequency response and time domain response, as shown here.

The FFT computes the coefficients for a periodic, ever repeating signal. In practical applications, signal segments are finite and not periodic. Just applying the FFT to a segment of a signal essentially wraps the end of the segment around to the start, generating a jump discontinuity. Such jumps result in an undesirable background artifacts in the FFT amplitudes. To make the wrap-around smooth, one can fade the signal to zero at both segment ends by multiplying it with a window function.

If the signal is essentially smooth, then even a simple linear fade to zero may not enough, since also kinks in the signal lead to some background artifacts in the amplitudes, however much smaller than those resulting from jumps. The choice of the windowing function is thus a balance between background artifact reduction and computational simplicity, and also of the length of the segment.

Additional considerations are required for overlap-add schemes, where the shifted window functions have to add to one.

• "Just applying the FFT to a segment of a signal essentially wraps the end of the segment around to the start, generating a jump discontinuity. " wow that is The most important point to remember – quantum231 Feb 3 '14 at 16:28

Basically, window functions are used to limit a signal in Time (to make it shorter), or to improve artifacts of the Fourier transform. The first function is easy to understand. The second explains why there are so many and in what way they differ. Depending on what details of the signal you are interested, you might choose a specific window function.