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.
This article tries to provide
a deeper insight into how truncation leads to these features. The goal of this
article is not a mathematically strict and thorough proof— instead, we aim to
demonstrate the truncation effects in an intuitive way.
Truncation of the impulse
response is equivalent to multiplying the desired impulse response,
hd[n]hd[n]
, by a rectangular window,
w[n]w[n]
. We saw that a time shift in
hd[n]hd[n]
is necessary to obtain a causal and
linear-phase response. Consider the designed filter as
h[n]=hd[n−M−12]w[n−M−12]h[n]=hd[n−M−12]w[n−M−12]
where
w[n]w[n]
represents a rectangular window which
is equal to one for
n=−M−12,...,+M−12n=−M−12,...,+M−12
and zero otherwise. Similar to the
first part of this article, we will review the concepts using an example.
Assume that
hd[n]hd[n]
is the response of an ideal low-pass
filter with cutoff frequency of
π4π4
. Moreover, suppose that
MM
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
hd,new[n]=hd[n−M−12]→Fe−jωM−12Hd(ω)hd,new[n]=hd[n−M−12]→Fe−jωM−12Hd(ω)
wnew[n]=w[n−M−12]→Fe−jωM−12W(ω)wnew[n]=w[n−M−12]→Fe−jωM−12W(ω)
where
Hd(ω)Hd(ω)
and
W(ω)W(ω)
are the Fourier transforms of
hd[n]hd[n]
and
w[n]w[n]
, respectively. Hence the Fourier transform of
h[n]h[n]
will be
H(ω)=12πHd,new[ω]∗Wnew[ω]=12π∫+π−π[e−j(ω−θ)M−12Hd(ω−θ))][e−jθM−12W(θ)]dθH(ω)=12πHd,new[ω]∗Wnew[ω]=12π∫−π+π[e−j(ω−θ)M−12Hd(ω−θ))][e−jθM−12W(θ)]dθ
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
H(ω)=12πe−jωM−12∫+π−πHd(ω−θ)W(θ)dθH(ω)=12πe−jωM−12∫−π+πHd(ω−θ)W(θ)dθ
It can be easily shown that
the spectrum of
w[n]w[n]
is
W(ω)=⎧⎩⎨sin(ωM2)sin(ω2)Mω≠0ω=0⎫⎭⎬W(ω)={sin(ωM2)sin(ω2)ω≠0Mω=0}
The normalized form of this
function,
W(ω)MW(ω)M
, is available in MATLAB through the
diric(ω,M)diric(ω,M)
command.
Figure (1) shows
W(ω)MW(ω)M
for
M=21M=21
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
±2πM±2πM
. Therefore, the main lobe width of a rectangular window will be
4πM4πM
. 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.
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).
If we consider
T1T1
,
T2T2
and
T3T3
as the equations that, respectively,
give the magenta, green, and red triangles of Figure (2), then we obtain
W(ω)M≈T1+T2+T3W(ω)M≈T1+T2+T3
Notice that each of
T2T2
and
T3T3
represent two triangles.
Substituting Equation (6)
into Equation (4), we obtain
H(ω)=12πe−jωM−12(Hd(ω)∗W(ω))≈M2πe−jωM−12(Hd(ω)∗(T1+T2+T3))H(ω)=12πe−jωM−12(Hd(ω)∗W(ω))≈M2πe−jωM−12(Hd(ω)∗(T1+T2+T3))
Due to the distributivity property of convolution, we are allowed
to calculate the convolution of
Hd(ω)Hd(ω)
with each of
T1T1
,
T2T2
and
T3T3
, 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
T1T1
, Figure (3a), with
Hd(ω)Hd(ω)
, Figure (3b), for
M=21M=21
. The convolution result is shown in Figure (3c). Note that the duration
of the triangle and
Hd(ω)Hd(ω)
is
4π214π21
and
π2π2
, respectively. However, the duration of the convolution result is
4π21+π24π21+π2
. This is related to a general property of convolution that if two signals,
x(t)x(t)
and
y(t)y(t)
, with durations of respectively
TxTx
and
TyTy
are convolved, the duration of the
result will be
Tx+TyTx+Ty
. In our case, this means that if the spectrum of the window was simply a
triangle with duration of
ω1ω1
, the transition band of the designed filter would be, roughly, of
width
ω1ω1
too.
Based on the previous
discussion, we can easily calculate the convolution of
Hd(ω)Hd(ω)
with
T2T2
and
T3T3
. 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
Hd(ω)∗T2Hd(ω)∗T2
is calculated. Figures (4a) and (4b)
show the convolution of
Hd(ω)Hd(ω)
with the right and left part of
T2T2
, 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
Hd(ω)∗T2Hd(ω)∗T2
which is the sum of the curves
in Figures (4a) and (4b). In a similar manner,
Hd(ω)∗T3Hd(ω)∗T3
can be found. This is shown in Figure
(5).
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
2. Hd(ω)∗T2Hd(ω)∗T2
3. and
4. Hd(ω)∗T3Hd(ω)∗T3
5. are much smaller than
6. Hd(ω)∗T1Hd(ω)∗T1
7. . 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
8. 4πM4πM
9. . As a result, in order to achieve a
sharper transition, we need to increase the window width,
10. MM
11. .
12. 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 firstsidelobe 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.
● 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,
● MM
● . Although this result was shown for a
rectangular window, the same conclusion can be drawn for other window
functions. Note that, unfortunately, increasing
● MM
● leads to
a higher computational complexity. Is there any way, other than increasing
● MM
● , 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?