Topic18 Design of FIR Filters
Topic18 Design of FIR Filters
y(t) = Cx(t − t0 )
and the frequency response
Y (ω) = CX(ω)e−jωt0
Y (ω)
⇒ H(ω) = = Ce−jωt0
X(ω)
• h[n] is symmetric or anti-symmetric around the midpoint of the filter, as shown below
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)
• 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
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
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
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
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 .
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
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
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:
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.]