You are on page 1of 7

EE 322M : Signal processing

Department of Electronics and Electrical Engineerng


Indian Institute of Technology, Guwahati
Winter 2023

Topic 18 : FIR filter design


Instruction and notes by : Manish

1 Linear Phase FIR filters


In digital communications applications, filters with a linear phase response are desired, because
such filters introduce a uniform delay as a function of frequency. In other words, we can say
that it ensures distortionless transmission, i.e.

y(t) = Cx(t − t0 )
and the frequency response

Y (ω) = CX(ω)e−jωt0
Y (ω)
⇒ H(ω) = = Ce−jωt0
X(ω)

Linear-phase FIR filters have a symmetric impulse response, i.e.:

• h[n] is symmetric or anti-symmetric around the midpoint of the filter, as shown below

If N is an odd integer, i.e. N = 2M + 1, then mid point is n0 = M . If N is even, i.e. N = 2M ,


th emidpoint is n0 = m − 12 .

Figure: Symmetric and antisymmetric impulse response examples

1
Reasoning for symmetry: we have

H(ω) = |H(ω)|e−jωt0
Z ∞
1
⇒ h(t) = |H(ω)|e−jωt0 ejωt dω
2π −∞
"Z Z ∞ #
0
1 −jωt0 jωt −jωt0 jωt
h(t) = |H(ω)|e e dω + |H(ω)|e e dω
2π −∞ 0
"Z #
∞ Z ∞
1 jωt0 −jωt −jωt0 jωt
h(t) = |H(ω)|e e dω + |H(ω)|e e dω
2π 0 0
Z ∞
1 
jω(t−t0 ) −jω(t−t0 )

h(t) = |H(ω)| e +e dω
2π 0
Z ∞
1
h(t) = |H(ω)| cos ω(t − t0 )dω
π 0
1 ∞
Z
⇒ h(t0 + t) = h(t0 − t) = |H(ω)| cos ω(t)dω
π 0
⇒ h(t0 + t) = h(t0 − t)

Hence, the symmetry.

To summarize, Linear phase FIR filters have the following properties:

• Linear phase refers to the constraint that the phase response is a linear (straight-line)
function of frequency

• A FIR filter is linear-phase if (and only if) its coefficients are symmetrical around the
center coefficient

Example: If h[n] = δ[n] + δ[n − 1], plot its H(z).


Solution: Given:
z+1
H(z) = 1 + z −1 =
z
So there is a pole at z = 0 and a zero at z = −1.

Homework: Draw the H(z) plot as a homework using above equation. The pole-zero plot
can be drawn on MATLAB using zplane(A,B) where A= [1 1] and B = [1 0].

2 FIR filter design


2.1 Window method
Let h[n], H(Ω) be an FIR filter with length M +1. To design the filter, we need to determine the
h[n] such that the actual frequency response of the filter H(Ω) provides a good approximation
to a desired (or ideal) frequency response Hd (Ω) in the frequency interval −π < Ω < π. As a
measure of the goodness of this approximation, we define the mean-square error
Z π
1
M SE = |Hd (Ω) − H(Ω)|2 dΩ
2π −π

2
From the Parseval’s theorem, we can rewrite the above equation as

X
M SE = |hd [n] − h[n]|2
n=−∞

h[n] has length M + 1 i.e. n = 0, .., M . To minimize the error we need to set:
(
hd [n], 0 ≤ n ≤ M
h[n] =
0, otherwise

The above equation is equivalent to defining a rectangular window defined by


(
1, 0 ≤ n ≤ M
w[n] =
0, otherwise

such that
h[n] = w[n]hd [n]
Such a design method is called window design method.
Now, the mean square error will be:
−1
X ∞
X
M SE = h2d [n] + h2d [n]
n=−∞ n=M +1

On the other hand, the above h[n] can be written in frequency domain as (its DTFT)
M
X
H(Ω) = h[n]e−jnΩ
n=0

or, since h[n] is multiplication of two signals in time domain, in frequency domain it will be
their convolution, i,e., Z π
1
H(Ω) = W (Φ)Hd (Ω − Φ)dΦ
2π −π
where we have derived W (Ω) in the previous topics as
sin((M + 1)Ω/2)
W (Ω) = e−jM Ω/2 , −π < Ω ≤ π
sin(Ω/2)

3
Since there are many sidelobes present, as seen in the figure, an alternative called Hamming
window is also often used. Hamming window is defined as:
(  
0.54 − 0.46 cos 2πnM
, 0≤n≤M
w[n] =
0, otherwise

Figure: A hamming window in time domain

Example 1: Let us consider that we want to design a low pass filter (let’s skip the spec-
ifications for now). We know that ideal LPF is not possible to design as it is not causal. Let
us design a practical finite length LPF. The ideal frequency response of a LPF is:
(
e−jΩn0 , if |Ω| < Ωc .
H(Ω) =
0, |Ω| < Ωc .

or, in time domain it will be a sinc function.


For practical implementation, we can either multiply it with a rectangular window or a
Hamming window. Mostly this process is done in time domain. Without going into details,
our final responses would look like:

4
Example (with specifications): Design a low-pass filter with ωp = 0.4π and ωs = 0.6π
which exhibits a minimum attenuation greater than 50 dB in the stop-band.
Solution: An ideal low-pass filter has infinite attenuation in the stop-band. When we
approximate an ideal filter with a practical filter using the window method, we accept some
approximation error. The peak approximation error depends on the window type and is known
for each window as reported

Since we need attenuation greater than 50 dB in the stop-band, we may use the Hamming
window.

In this example, the transition band is ωs − ωp = 0.2π. Since the main lobe width of the
Hamming window is approximately 8π M
, we find that M = 40. This means that the designed
filter will be of length = 41. Thus the hamming window equation becomes:
(  
0.54 − 0.46 cos 2πn
40
, 0 ≤ n ≤ 40
w[n] =
0, otherwise

The cut-off frequency of the filter can be assumed to be (ωc = ωp + ωs )/2. Hence, here,
ωc = 0.5π. Thus, the time domain equation of the desired filter response becomes
0.5π 0.5πn n
hd [n] = sinc = 0.5sinc
π π 2
To have a causal linear-phase response, we need to apply a time shift equal to M/2 in the
desired impulse response and multiply the result by w[n]. Thus, finally the designed filter will
have the response: h  2πn ih n − 20 i
h[n] = 0.54 − 0.46 cos 0.5sinc
40 2

2.2 Frequency sampling design method


An alternate method of FIR filter design, frequency sampling method, is to simply take the
frequency domain transfer function and then inverse Fourier transfer to find the filter’s impulse
response. However, within a computer only the samples of the desired Fourier transform can
be programmed. Hence, to obtain a good approximation to the desired frequency response, we
must take a sufficient number of the frequency samples. The process of designing is simple:

We first begin by choosing a desired (or ideal) frequency response Hd (ω). then we take
samples of Hd (ω) at N -points by taking ω = ωk = 2πk/N where k = 0, 1, 2, 3, ...(N − 1).).
To obtain a good approximation of the desired frequency response, a sufficiently large number

5
of the frequency samples should be taken. This sampling is equivalent to generating a DFT
sequence:
H̃[k] = Hd (ωk ) = Hd [2πk/N ], k = 0, 1, 2, 3, ..., (N − 1)
Once the DFT is known, h[n] can be computed by taking its IDFT: Without going into details,
using IDFT formula leads to:
UL
1h X i
h[n] = H̃[0] + 2 Re{H̃[k]ej2πk/N }
N k=1

where U L = (N2−1) if N = odd; and U L = N


2
− 1 if N = even. This is called type-1 frequency
sampling method.

Corresponding to the N frequencies at which an N -point DFT is evaluated, there is a second


set of uniformly spaced frequencies for which a frequency sampling structure can conveniently
be obtained. This alternative is called type-2 frequency sampling method, where frequency

sampling is done at ω = ωk = 2N (2k + 1) points. Type 2 frequency samples give additional
flexibility in the design method to specify the desired frequency response at a second possible
set of frequencies.

Advantage: This method is useful for the design of non-prototype filters where the desired
magnitude response can take any irregular shape.
Disadvantage
One disadvantage with this method is that the frequency response obtained by interpola-
tion is equal to the desired frequency response only at the sampled points. At the other points,
there will be a finite error present.

Example: Use the frequency sampling method to design a 9-tap lowpass FIR filter with a
cutoff frequency of 0.25π radians/sample.
Solution: First, let us find the magnitude of the samples of H(ω). Assuming an ideal
response, the samples below cut-off 0.25π are equal to 1 and the other samples are zero. Then,
we obtain

6
Now, from the equation in section 2.2, we can write its impulse response as
1 2πn
h[n] = [1 + 2 cos( )]
9 9
Based on this equation, we obtain the samples in the time-domain as:

Thus, the frequency response of the designed filter is shown below

Reference material
1. Textbook: Signals and Systems by Alan Oppenheim
2. Topic notes are inspired from the course materials of UCSB’s Discrete-time signals course.
[Please report any typos in the notes by sending an email to the instructor.]

You might also like