Undesired Effects of a Window Function in FIR Filter Design - LEKULE BLOG

## Saturday, 9 July 2016

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,
. We saw that a time shift in
is necessary to obtain a causal and linear-phase response. Consider the designed filter as

##### Equation (1)

where

represents a rectangular window which is equal to one for
and zero otherwise. Similar to the first part of this article, we will review the concepts using an example. Assume that
is the response of an ideal low-pass filter with cutoff frequency of
. Moreover, suppose that
is an odd number.

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
are the Fourier transforms of
and
, respectively. Hence the Fourier transform of
will be

##### 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
command.
Figure (1) shows

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
. As shown in Figure (1), the peak sidelobe of a window is the amplitude of the largest sidelobe. We will verify that these two properties determine the smoothness of the transition band and the passband ripples in filters designed by the window method.

### 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.

If we consider

,
and
as the equations that, respectively, give the magenta, green, and red triangles of Figure (2), then we obtain

##### Equation (6)

Notice that each of

and
represent two triangles.

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
,
and
, and then add the results to achieve the overall convolution.

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

, Figure (3a), with
, Figure (3b), for
. The convolution result is shown in Figure (3c). Note that the duration of the triangle and
is
and
, respectively. However, the duration of the convolution result is
. This is related to a general property of convolution that if two signals,
and
, with durations of respectively
and
are convolved, the duration of the result will be
. In our case, this means that if the spectrum of the window was simply a triangle with duration of
, the transition band of the designed filter would be, roughly, of width
too.

##### 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
and
. We only need to take the required x-axis shifts into account and scale the result with respect to the height of each triangle.
Figure (4) shows how

is calculated. Figures (4a) and (4b) show the convolution of
with the right and left part of
, respectively. The shift in the x-axis and the scale in the y-axis correspond to the location and height of the green rectangles in Figure (2). Figure (4c) shows
which is the sum of the curves in Figures (4a) and (4b). In a similar manner,
can be found. This is shown in Figure (5).

##### with T3

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:
1. Please notice that the magnitude of
and
are much smaller than
. This is due to the fact that the magnitude of the sidelobes is much smaller than that of the main lobe. Therefore, the overall shape of the frequency response of the designed filter is 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
. As a result, in order to achieve a sharper transition, we need to increase the window width,
1. .
2. 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.

### 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,
. Although this result was shown for a rectangular window, the same conclusion can be drawn for other window functions. Note that, unfortunately, increasing
leads to a higher computational complexity. Is there any way, other than increasing
• , to reduce the main lobe width and achieve a sharper transition?
• The peak sidelobe determines the amount of ripples in the passband and stopband of the achieved filter. How can we reduce the peak sidelobe in FIR filter design via window method?