Finite Impulse Response (FIR) Filter
Finite Impulse Response (FIR) Filter
In many cases a linear phase c/cs is required throughout the pass-band of the filter to preserve the
shape of a given signal within the pass-band. Assume a LP filter with
(1)
y(n) = x (n – α )
The linear phase filter did not alter the shape of the original signal, simply translated it by an amount
α. If the phase response had not been linear, the output signal would have been a distorted version of
x(n).
In Fig.1 the responses of two different filters to the same input (a sum of two sinusoidal signals) is
presented. The filters have the same magnitude frequency responses but differ in their phases as one
has linear and the other a quadratic phase. For the filter with linear phase, the sinusoidal components
each go through a steady state phase change, but in such a way that the output signal is just a delayed
version of the input while the quadratic phase filter causes phase shifts in the two sinusoidal signals
resulting in an output that is a distorted version of the input signal.
It can be shown that a causal IIR filter cannot produce a linear phase characteristic and that only
special forms of causal FIR filters can give linear phase. This result is clarified in the following
theorem.
Theorem. If h(n) represents the impulse response of a discrete-time system, a necessary and sufficient
condition for linear phase is that h(n)
- It have finite duration N (for causal FIR filter, h(n) begins at zero and ends at N-1)
- It is symmetric about its midpoint.
h(n) = h( N-1-n) , n = 0, 1, …., N-1
103
Digital Signal Processing / 4th Class/ 2022-2023
104
Digital Signal Processing / 4th Class/ 2022-2023
Figure 2 General shapes of h(n) that give linear phase for odd and even N.
(2)
(3)
For N odd, the slope of (N–1) /2 causes a delay in the output of (N–1)/2 , which is an integer number
of samples, whereas for N even, the slope causes a non-integer delay. The non-integer delay will cause
the values of the sequence to be changed, which, in some cases, may be undesirable.
The easiest way to obtain an FIR filter is to simply truncate the impulse response of an IIR filter. If
hd(n) represents the impulse response of a desired IIR filter, then an FIR filter with impulse response
h(n) can be obtained as follows:
(4)
(5)
105
Digital Signal Processing / 4th Class/ 2022-2023
(6)
Rectangular window has a narrow main lobe and wide side lobes . The minimum stopband attenuation
is 21 dB.
2. Bartlett: The main-lobe width for the Bartlett window is 8π/N, which is twice of the
rectangular one. The maximum side lobe for the triangular window is 27 dB lower than the main lobe,
and the minimum stopband attenuation is 25 dB.
106
Digital Signal Processing / 4th Class/ 2022-2023
(7)
3. Hanning: It has a main-lobe width considerably larger than that of the Bartlett window, but
with much lower largest side-lobe peak, at about -32 dB. The side lobes also taper off much faster. It
has 8π/N between the two zeros surrounding the main lobe.
(8)
4. Hamming: Like the Hanning window, the Hamming window also belongs to a kind of the
raised cosine window, and thus exhibits similar characteristic to the Hanning window, but further
suppresses the first side lobe
(9)
For the Hamming window, 99.96% of the energy is in the main lobe. The maximum side lobe is 43 dB
lower than the main lobe, and the minimum stopband attenuation is 53 dB.
5. Blackman: The Blackman method is used to reduce variance of the estimator thus presents
improvement in stopband attenuation. As compared to other windows, the Blackman window
possesses good characteristics for audio processing,
(10)
The maximum side lobe for the Blackman window is 58 dB lower than the main lobe, which is three
times as that of rectangular window, and the minimum stopband attenuation is 74 dB.
107
Digital Signal Processing / 4th Class/ 2022-2023
108
Digital Signal Processing / 4th Class/ 2022-2023
An ideal LP filter with linear phase of slope −α and cutoff wc can be characterized in frequency
domain by:
(11)
The corresponding impulse response hd(n) can be obtained by taking the inverse Fourier transform of
Hd(ejw) and easily shown to be
(12)
A causal FIR filter with impulse response h(n) can be obtained by multiplying h d(n) by a window
beginning at the origin and ending at N - 1 as follows:
(13)
For h(n) to be a linear phase filter, a must be selected so that α = (N-1) / 2 , with N is odd.
Table (1) shows hd(n) for LPF, HPF, BPF, and BSF:
109
Digital Signal Processing / 4th Class/ 2022-2023
Notes:
- The stop-band gain for the LPF designed is relatively insensitive to the size of the window.
- The transition width of the designed LPF is approximately equal to the main lobe of the
window used.
Design procedure for an FIR filter
Requirements: k1, w1, k2, and w2 represents the cutoff and stop-band requirements for digital
filters.
1- From Table (2), select the window type such that the stop-band gain exceeds k2.
2- Select the number of points in the window to satisfy the transition width for the type of
window used
4- Find h(n) using the specified window type and Table (1).
Example 1: Design a LP digital filter to be used in A/D- H(Z) – D/A structure that will have a − 3 dB
cutoff of 30 π rad / sec. and an attenuation of 50 dB at 45 π rad/sec. The filter is required to have
linear phase. The system will use a sampling rate of 100 samples/sec.
Solution:
w1=Ω1T=30π/100=0.3π rad
w2=Ω2T=45π/100=0.45 π rad
1- To obtain a stopband attenuation of -50 dB or more, a Hamming, or Blackman window could
be used. The Hamming window is chosen since it has the smallest transition band thus giving
the smallest N.
2- The approximate number of points needed to satisfy the transition band requirement can be
found for w1 = 0.3 π and w2 = 0.45 π using the Hamming window ,
110
Digital Signal Processing / 4th Class/ 2022-2023
Example 2: An analog signal contains frequencies up to 10 KHz. The signal is sampled at 50 KHz.
Design an FIR filter having linear phase characteristic and transition band of 5 KHz. The filter should
provide minimum 50 dB attenuation at the end of transition band?
Solution:
f1 =10 KHz , f2=(10+5)=15 KHz
w1=Ω1T=2πf1T=2π×10000/50000=0.4π rad
w2=Ω2T=2πf2T=2π×15000/50000=0.6 π rad
1- To obtain a stopband attenuation of -50 dB or more, a Hamming, or Blackman window could
be used. The Hamming window is chosen since it has the smallest transition band thus giving
the smallest N.
2- The approximate number of points needed to satisfy the transition band requirement can be
found for w1 = 0.4 π and w2 = 0.6 π using the Hamming window (k = 4) to be
N ≥ 8π /((0.6 − 0.4)π) = 40 →N= 41
Example 3: Design a LPF using Hanning window for the desired frequency response of a low pass
filter given by wc = 0.5π rad/sec, and take N=11. Find the values of h(n) at n=4 ,5?
Solution:
Since the type of window and N are given ,we start from step 3
3- wc =0.5π rad , and α = ( 11− 1 ) /2 = 5.
4- Using eq. (8) for wHan and the value of hd(n) from Table (1) to find h(n):
sin(0.5𝜋(𝑛−5)) 2𝜋𝑛
ℎ(𝑛 ) = [0.5(1 − cos( 10 )]
𝜋(𝑛−5)
at n=4
111
Digital Signal Processing / 4th Class/ 2022-2023
sin(0.5𝜋(𝑛−5)) 8𝜋
ℎ(4) = [0.5 (1 − cos ( 10 )] = 0.2879
𝜋(𝑛−5)
at n=5
0.5𝜋 10𝜋 𝑤𝑐
ℎ(5) = [0.5 (1 − cos ( ))] = 𝜋[0.5(1 − (−1))] = 0.5 =
𝜋 10 𝜋
Example 4: Design a HP digital filter to be used in A/D- H(Z) – D/A structure that will have a − 3 dB
cutoff of 45 π rad / sec. and an attenuation of 50 dB at 30 π rad/sec. The filter is required to have
linear phase. The system will use a sampling rate of 100 samples/sec.
Solution:
w1=Ω1T=45π/100=0.45π rad
w2=Ω2T=30π/100=0.3 π rad
1-To obtain a stopband attenuation of -50 dB or more, a Hamming, or Blackman window could be
used. The Hamming window is chosen since it has the smallest transition band thus giving the
smallest N.
2- The approximate number of points needed to satisfy the transition band requirement can be
found for w2 = 0.3 π and w1 = 0.45 π using the Hamming window ,
N ≥ 8π / (0.45 − 0.3 ) π = 53.3 →N= 55
sin[0.45𝜋(𝑛−27)]
ℎ (𝑛 ) = − . {0.54 − 0.46cos(2𝜋𝑛/54}, 0 ≤ 𝑛 ≤ 54
𝜋(𝑛−27)
112