# Undesired Effects of a Window Function in FIR Filter Design

As mentioned in the first part of
this article, a smoother transition band and ripples in the passband are
the most important differences between the ideal filters and those
designed by window method.

### Main Lobe Width and Peak Sidelobe of a Window

Truncation of the impulse response is equivalent to multiplying the desired impulse response,, by a rectangular window,

#####
*Equation (1)*

where

represents a rectangular window which is equal to one for

To analyze the frequency response of the designed filter, we need to calculate the discrete-time Fourier transform of Equation (1). From our “Signals and Systems” course, we recall that multiplication in the time domain is equal to convolution in the frequency domain. In order to apply this to Equation (1), we first calculate the spectrum of each term in this equation. Considering the time-shifting property in Fourier transform, we obtain

#####
*Equation (2)*

where

and

#####
*Equation (3)*

where

denotes the convolution. Equation (3) means that we should shift the desired spectrum continuously and multiply the shifted spectrum by the window response and then calculate the integral.

Equation (3) can be simplified as

#####
*Equation (4)*

It can be easily shown that the spectrum of

is

#####
*Equation (5)*

The normalized form of this function,

, is available in MATLAB through the

Figure (1) shows

for

#####
**Figure (1)**

**Figure (1)**

#####
* for
*

#####
*.*

This figure points out the two most important features of a window function, i.e. the “main lobe width” and the “peak sidelobe”. The main lobe width can be calculated by subtracting the first two roots of Equation (5) which are at

. Therefore, the main lobe width of a rectangular window will be

### Simple Approximations for a Window Spectrum

In order to examine the important features of a window function, we approximate the spectrum in Figure (1) with five triangles as shown in Figure (2).#####
**Figure (2) **Approximating the window spectrum with 5 triangles.

**Figure (2)**Approximating the window spectrum with 5 triangles.

If we consider

,

#####
*Equation (6)*

Notice that each of

and

Substituting Equation (6) into Equation (4), we obtain

#####
*Equation (7)*

Due to the distributivity property of convolution, we are allowed to calculate the convolution of

with each of

The convolution of a rectangular function with a triangle is shown in Figure (3). This figure, actually, demonstrates the convolution of

, Figure (3a), with

*roughly,*of width

#####
**Figure (3) **(3a) The normalized triangle approximating the main lobe; (3b) spectrum of the desired filter; (3c) convolution of (3a) and (3b)

**Figure (3)**(3a) The normalized triangle approximating the main lobe; (3b) spectrum of the desired filter; (3c) convolution of (3a) and (3b)

Based on the previous discussion, we can easily calculate the convolution of

with

Figure (4) shows how

is calculated. Figures (4a) and (4b) show the convolution of

#####
**Figure (4)** (4a) Convolution of

**Figure (4)**(4a) Convolution of

#####
* with the right triangle of
*

#####
* ; (4b) convolution of
*

#####
* with the left triangle of
*

#####
* ; (4c) convolution of
*

#####
* with
*

#####
**Figure (5)** (5a) Convolution of

**Figure (5)**(5a) Convolution of

#####
* with the right triangle of
*

#####
* ; (4b) convolution of
*

#####
* with the left triangle of
*

#####
* ; (4c) convolution of
*

#####
* with
*

Now that we have calculated all the required terms of Equation (7), we can find the response of the designed filter. Figure (6) summarizes the obtained results and shows the sum of them. The most important observations are as follows:

- Please notice that the magnitude of

*roughly*determined by the main lobe. Approximating the main lobe with a triangle, we saw that the main lobe width increases the transition band. Hence, it is desirable to reduce the main lobe width. For the case of a rectangular window, the main lobe width is equal to

- .
- Although the overall shape of the designed filter is determined by the main lobe, the sidelobes can produce ripples in the passband and stopband of the achieved filter. The magnitude of the ripples depends on how strong the sidelobes are compared to the main lobe. Usually, the first sidelobe is larger than the other ones. Hence, we can consider the magnitude of the first sidelobe as the parameter which determines the magnitude of ripples in the achieved filter.

#####
**Figure (6) **Convolution of

**Figure (6)**Convolution of

#####
*with (6a)
*

#####
* (6b)
*

#####
* (6c)
*

#####
* and (6d)
*

### Summary

- The spectrum of the rectangular window will make the response of the designed filter deviate from the ideal response.
- The main lobe width affects the transition band of the designed filter.
- To reduce the main lobe width, we may increase the window width,