FIR Digital Filters
FIR Digital Filters
net
FIR Filters
9
ww
w .Ea
9.1 INTRODUCTION
syE
A filter is a frequency selective system. Digital filters are classified as finite duration unit
ngi
impulse response (FIR) filters or infinite duration unit impulse response (IIR) filters,
depending on the form of the unit impulse response of the system. In the FIR system, the
impulse response sequence is of finite duration, i.e., it has a finite number of non-zero terms.
nee
The IIR system has an infinite number of non-zero terms, i.e., its impulse response sequence
is of infinite duration. IIR filters are usually implemented using recursive structures
rin
(feedback-poles and zeros) and FIR filters are usually implemented using non-recursive
structures (no feedback-only zeros). The response of the FIR filter depends only on the
g.n
present and past input samples, whereas for the IIR filter, the present response is a function
of the present and past values of the excitation as well as past values of the response.
The following are the main advantages of FIR filters over IIR filters:
1.
2.
3.
FIR filters are always stable.
FIR filters with exactly linear phase can easily be designed. e
FIR filters can be realized in both recursive and non-recursive structures. t
4. FIR filters are free of limit cycle oscillations, when implemented on a finite word
length digital system.
5. Excellent design methods are available for various kinds of FIR filters.
The disadvantages of FIR filters are as follows:
1. The implementation of narrow transition band FIR filters is very costly, as it
requires considerably more arithmetic operations and hardware components such as
multipliers, adders and delay elements.
2. Memory requirement and execution time are very high.
651
www.EasyEngineering.net
www.EasyEngineering.net
FIR filters are employed in filtering problems where linear phase characteristics within the
pass band of the filter is required. If this is not required, either an FIR or an IIR filter may
be employed. An IIR filter has lesser number of side lobes in the stop band than an FIR
filter with the same number of parameters. For this reason if some phase distortion is
tolerable, an IIR filter is preferable. Also, the implementation of an IIR filter involves fewer
parameters, less memory requirements and lower computational complexity.
ww H ( z) =
N 1
h(n) z n
n0
w
where h(n) is the impulse response of the filter. The frequency response [Fourier transform
.Ea
of h(n)] is given by
N 1
H (X ) = h(n) e jX n
syE n0
–p £ w £ p
e t
where a is constant phase delay in samples.
dR (X ) d R (X ) BX
Ug = = ( BX ) = B and U p = = =B
dX dX X X
i.e. tp = tg = a which means that a is independent of frequency.
We have
N 1
h(n) e jX n = H (X ) e jR (X )
n0
www.EasyEngineering.net
www.EasyEngineering.net
N 1
i.e. h(n)[cos X n j sin X n] = H (X ) [cos R (X ) + j sin R (X )]
n 0
This gives us
N 1
N 1
and h(n) sin X n = H (X ) sin R (X )
n 0
ww N 1
h(n) sin X n
n0 sin R (X ) sin BX
w
Therefore,
.Ea
N 1
h(n) cos X n
n0
=
cos R (X )
=
cos BX
i.e. syE N 1
i.e.
N 1
ngi
h(n) sin (B n) X = 0
This will be zero when
n0
B
nee
N 1
h(n) = h(N – 1 – n) and =
2
, for 0 n N 1
rin
This shows that FIR filters will have constant phase and group delays when the impulse
response is symmetrical about a = (N – 1)/2.
The impulse response satisfying the symmetry condition h(n) = h(N – 1 – n) for odd g.n
and even values of N is shown in Figure 9.1. When N = 9, the centre of symmetry of the
sequence occurs at the fourth sample and when N = 8, the filter delay is 3 12 samples. e t
Figure 9.1 Impulse response sequence of symmetrical sequences for (a) N odd (b) N even.
www.EasyEngineering.net
www.EasyEngineering.net
If only constant group delay is required and not the phase delay, we can write
q (w) = b – aw
Now, we have
H (X ) = H (X ) e j (C BX )
N 1
i.e. h(n) e jX n = H (X ) e j ( C BX )
n0
N 1
ww
i.e.
This gives
n 0
w .Ea
N 1
h(n) cos X n =
n 0
H (X ) cos(C BX )
and
syE
N 1
h(n)sin X n =
n 0
H (X ) sin (C BX )
N 1
h(n) cos X n
=
nee
cos( C BX )
n 0
N 1
h(n) sin [ C (B n) X ] = 0
e t
n 0
Q
If C = , the above equation can be written as:
2
N 1
h(n) cos (B n) X = 0
n 0
www.EasyEngineering.net
www.EasyEngineering.net
This shows that FIR filters have constant group delay tg and not constant phase delay when
the impulse response is antisymmetrical about a = (N – 1)/2.
The impulse response satisfying the antisymmetry condition is shown in Figure 9.2.
When N = 9, the centre of antisymmetry occurs at fourth sample and when N = 8, the centre
of antisymmetry occurs at 3 12 samples. From Figure 9.2, we find that h[(N – 1)/2] = 0 for
antisymmetric odd sequence.
ww
w .Ea
syE
Figure 9.2 Impulse response sequence of antisymmetric sequences for (a) N odd (b) N even.
the equation
N 1
nee
h(n) sin (B n) X = 0 is satisfied.
Solution:
n 0
= h(0) sin 3X + h(1) sin 2X + h(2) sin X + h(3) sin 0 + h(4) sin ( X )
+ h(5) sin ( 2X ) + h(6) sin ( 3X )
=0
N 1
Hence, the equation h(n) sin (B n) X = 0 is satisfied.
n 0
www.EasyEngineering.net
www.EasyEngineering.net
EXAMPLE 9.2 The following transfer function characterizes an FIR filter (N = 9).
Determine the magnitude response and show that the phase and group delays are constant.
N 1
H (z ) = h(n) z n
n=0
w
The phase delay B
.Ea=
N 1 9 1
2
=
2
= 4 . Since a = 4, the transfer function can be expressed
as:
syE
H ( z ) = z 4 [ h(0) z 4 + h(1) z 3 + h(2) z 2 + h(3) z1 + h(4) z 0 + h(5) z 1 + h(6) z 2
+ h(7) z 3 + h(8) z 4 ]
where H (X ) is the magnitude response and q(w) = – 5w is the phase response. The phase
delay tp and group delay tg are given by
R (X ) d (R (X )) d ( 5X )
Up = = 5 and U g = = =5
X dX dX
Thus, the phase delay and the group delay are the same and are constants.
www.EasyEngineering.net
www.EasyEngineering.net
ww 2.
3.
4.
Symmetrical impulse response when N is even.
Antisymmetric impulse response when N is odd.
Antisymmetric impulse response when N is even.
w .Ea
9.3.1 Frequency Response of Linear Phase FIR Filter when Impulse Response
is Symmetrical and N is Odd
syE
Let h(n) be the impulse response of the system. The frequency response of the system H(w)
is given as:
H (X ) =
ngi
n=
h(n) e jX n
nee
Since the impulse response of the FIR filter has only N samples, the limits of summation can
be changed to n = 0 to N – 1.
\ H (X ) =
N 1
h(n) e jX n rin
n0
g.n
e
When N is odd number, the symmetrical impulse response will have the centre of symmetry
at n = (N – 1)/2. Hence H(w) is expressed as:
H (X ) =
(N 3)/2
N 1 jX
h(n) e jX n + h
2
e
N 1
2
+
N 1
h(n) e jX n
t
n 0 n ( N 1)/2
Let m = N – 1 – n, \n=N–1–m
N +1 N + 1 N 3
When n = , m = (N 1) =
2 2 2
When n = N – 1, m = (N – 1) – (N – 1) = 0
www.EasyEngineering.net
www.EasyEngineering.net
Therefore,
N 1
N 1 jX
(N 3)/2 (N 3)/2
jX n 2
H (X ) = h(n) e + h e + h( N 1 m) e jX (N 1 m )
n 0 2 m0
Replacing m by n, we get
N 1
N 1 jX
(N 3)/2 (N 3)/2
2
H (X ) = h(n) e jX n + h e + h( N 1 n) e jX (N 1 n )
n 0 2 n0
ww Hence
H (X ) =
( N 3)/2
N 1 jX
h(n) e jX n + h
N 1
2
( N 3)/2
h(n) e jX ( N 1) jX ( n)
w n0
.Ea
2
e +
n0
jX n + jX N 1
jX ( n )
N 1 N 1
jX (N 3)/2 jX ( N 1) + jX
N 1
=e
syE
2
h
2
+
n0
h(n)
e 2
+ e 2
=e
N 1
jX
2
N 1
h +
(N 3)/2
h (nngi
)
jX N 1 n
e 2
+ e
jX N 1
N 1
2
n
2
n0
nee
jX N 1 n n
rin
N 1 N 1
jX (N 3)/2 jX
N 1
=e 2
h + h (n)
e 2
+ e 2
2
g.n
n0
N 1
jX N 1 (N 3)/2 N 1
N 1
=e 2
h
2
+ h(n) 2 cos
n0
N 1
2
n X
e t
Let k = n, \ n= k
2 2
N 1
When n = 0, k=
2
N 3 N 1 N 3
When n = , k= =1
2 2 2
N 1
jX N 1 (N 1)/2 N 1
\ H (X ) = e 2
h + 2h k cos X k
2 2
k 1
www.EasyEngineering.net
www.EasyEngineering.net
Replacing k by n, we get
N 1
jX N 1 (N 1)/2 N 1
H (X ) = e 2
h + 2h n cos X n
2 n 1 2
The above equation for H(w) is the frequency response of linear phase FIR filter when
impulse response is symmetrical and N is odd.
The magnitude function of H(w) is given by
( N 1)/2
N 1 N 1
H (X ) = h n cos X n
ww 2
w .Ea N 1
H (X ) = X
2
= XB where B= N 1
2
syE
Figure 9.3(a) shows a symmetrical impulse response when N = 9 and Figure 9.3(b) shows
the corresponding magnitude function of frequency response. From these figures it can be
observed that the magnitude function of H(w) is symmetric with w = p, when the impulse
response is symmetric and N is odd number.
ngi
nee
rin
g.n
e t
Figure 9.3 (a) Symmetrical impulse response, N = 9 (b) Magnitude function of H(w).
9.3.2 Frequency Response of Linear Phase FIR Filter when Impulse Response
is Symmetrical and N is Even
The Frequency response of FIR filter, with impulse response h(n) of length N is:
N 1
H (X ) = h(n) e jX n
n0
www.EasyEngineering.net
www.EasyEngineering.net
For symmetrical impulse response with even number of samples (i.e. when N is even), the
centre of symmetry lies between n = (N/2) – 1 and n = N/2. Hence H(w) is expressed as:
(N/2) 1 N 1
H (X ) = h(n) e jX n + h(n) e jX n
n0 n N/2
Let m = N – 1 – n, \ n =N–1–m
N N N
When n = , m=N–1– = –1
2 2 2
When n = N – 1, m = N – 1 – (N – 1) = 0
ww
Therefore, the above equation for H(w) can be written as:
w H (X ) =
.Ea
Replacing m by n, we get
(N/2) 1
n0
h(n) e jX n +
(N/2) 1
m0
h(N 1 m) e jX (N 1 m )
syE
H (X ) =
( N/2) 1
h(n) e jX n +
( N/2) 1
h(N 1 n) e jX (N 1 n )
n0
jX
N 1 (N/2) 1 jX n + jX N 1
h (n ) e
g.n
jX ( n ) jX (N 1) + jX
N 1
=e 2
n 0
(N/2) 1
2 +e
e 2
t
jX N 1 n n
N 1 N 1
jX jX
2 2
=e 2 h (n) e + e
n 0
jX
N 1 (N/2) 1 N 1
=e 2
h(n) 2 cos X n
n 0 2
N N
Let k = – n, \ n= –k
2 2
www.EasyEngineering.net
www.EasyEngineering.net
N
When n = 0, k=
2
N N N
When n = – 1, k= 1 = 1
2 2 2
Therefore, the above expression for H(w) becomes
jX
N 1 N/2 N 1
H (X ) = e 2
2h k cos X k
k 1 2 2
ww
On replacing k by n, we get
H (X ) = e
jX
N 1 N/2 N 1
2h n cos X n
w .Ea
2
n 1 2 2
This is the expression for frequency response of linear phase FIR filter when impulse
response is symmetrical and N is even. The magnitude function of H(w) is given by
syE N/2 N 1
H (X ) 2h n cos X n
n 1
N 1
H (X ) = X
2
= XB nee where B =
N 1
2
rin
Figure 9.4(a) shows a symmetrical impulse response when N = 8, and Figure 9.4(b)
shows the corresponding magnitude function of frequency response. From these figures it
can be observed that the magnitude function of H(w) is antisymmetric with w = p, when
g.n
e
impulse response is symmetric and N is even number.
Figure 9.4 (a) Symmetrical impulse response, N=8, (b) Magnitude function of H(w).
www.EasyEngineering.net
www.EasyEngineering.net
9.3.3 Frequency Response of Linear Phase FIR Filter when Impulse Response
is Antisymmetric and N is Odd
The frequency response of linear phase FIR filter with impulse response h(n) of length N is:
N 1
H (X ) = h(n) e jXn
n0
ww H (X ) =
(N 3)/2
n0
h(n) e jX n N 1 jX
+ h
2
e
N 1
2
+
N 1
n ( N 1)/2
h(n) e jX n
w .Ea
=
( N 3)/2
n0
h(n) e jX n +
N 1
n ( N 1)/2
h(n) e jX n
Let m = N – 1 – n,
syE \ n =N–1–m
N +1 N 3
ngi
N +1
When n = , m=N–1– =
2 2 2
When n = N – 1, m = N – 1 – (N – 1) = 0
\ H (X ) =
( N 3)/2
h(n) e jX n +
nee
( N 3)/2
h(N 1 m) e jX (N 1 m )
n0 m0
rin
On replacing m by n, we get
For antisymmetric impulse response, h(N – 1 – n) = – h(n). Hence, the above equation for
e t
H(w) can be written as:
( N 3)/2 ( N 3)/2
H (X ) = h(n) e jX n + h(n) e jX ( n) jX ( N 1)
n 0 n0
N 1
jX (N 3)/2 jX n + jX N 1 N 1
jX ( n ) jX (N 1) + jX
2
2 2
=e h ( n) e e
n 0
www.EasyEngineering.net
www.EasyEngineering.net
N 1
jX (N 3)/2 jX N 1 n N 1
jX n
2 2 2
=e h ( n) e e
n 0
N 1
jX (N 3)/2 N 1
h( n) 2 j sin X
2
=e n
n 0 2
Since j = e jp/2
N 1
(N 3)/2
ww jX Q
N 1
H (X ) = e 2 h(n) e 2 sin X
j
2
n
n 0 2
w .Ea =e
Q
j X
2
N 1
2
(N 3)/2 N 1
2h(n) sin X
n 0 2
n
Let k =
N 1
– n, syE \ n=
N 1
–k
ngi
2 2
N 1
When n = 0, k=
When n =
N 3
, k=
2
N 1 nee
N 3
=1
2 2 2
rin
\ H (X ) = e
Q
2
N 1 ( N 1)/2
j X
2
N 1
2h
2
k sin X k
g.n
Replacing k by n, we get
Q
k 1
N 1 ( N 1)/2
e t
j X N 1
H (X ) = e 2 2
2h
2
n sin X n
n 1
This is the equation for frequency response of linear phase FIR filter when impulse response
is antisymmetric and n odd. The magnitude function is given by
(N 1)/2
N 1
H (X ) = 2h n sin X n
n 1 2
www.EasyEngineering.net
www.EasyEngineering.net
ww
w .Ea
syE
ngi
Figure 9.5 nee
(a) Antisymmetric impulse response for N = 9, (b) Magnitude function of H(w).
9.3.4 Frequency Response of Linear Phase FIR Filter when Impulse Response rin
is Antisymmetric and N is Even
g.n
The frequency response of linear phase FIR filter with impulse response h(n) of length N is:
H (X ) =
N 1
n0
h(n) e jX n e t
The impulse response h(n) is antisymmetric with centre of antisymmetry in between
n = (N/2) – 1 and n = (N/2). Hence H(w) can be expressed as:
( N/2) 1 N 1
H (X ) = h(n) e jX n + h( n) e jX n
n0 n N/2
Let m = N – 1 – n, \n =N–1–m
N N N
When n = , m=N–1– = 1
2 2 2
When n = N – 1, m = N – 1 – (N – 1) = 0
www.EasyEngineering.net
www.EasyEngineering.net
( N/2) 1 ( N/2) 1
\ H (X ) = h(n) e jX n + h(N 1 m) e jX ( N 1 m )
n0 m0
Replacing m by n, we have
(N/2) 1 (N/2) 1
H (X ) = h(n) e jX n + h(N 1 n) e jX ( N 1 n)
n0 n0
For antisymmetric impulse response, h(N – 1 – n) = – h(n). Hence the above equation for
H(w) can be written as:
ww H (X ) =
(N/2) 1
n0
h(n) e jX n +
( N/2) 1
n0
h(n) e jX ( n) jX ( N 1)
w .Ea
=e
N 1
jX
2
(N/2) 1
n0
jX n + jX N 1
h ( n) e
2
e
N 1
jX ( n ) jX ( N 1) + jX
2
syE N 1 ( N/2) 1
jX
2
jX N 1 n
2
e
N 1
jX
2
n
ngi
=e h ( n) e
n0
=e
N 1
jX
2
( N/2) 1
n0
nee
N 1
h( n) 2 j sin X
2
n
( N/2) 1 N 1
2h( n) sin X
2
n
e t
n 0 2
N N
Let k = – n, \ n= –k
2 2
N
When n = 0, k=
2
N N N
When n = – 1, k= 1 = 1
2 2 2
www.EasyEngineering.net
www.EasyEngineering.net
Q N 1
j X N/2 N 1
\ H (X ) = e 2 2
2 h k sin X k
k 1 2 2
Replacing k by n, we get
Q N 1
j X N/2 N 1
H (X ) = e 2 2
2 h n sin X n
n 1 2 2
This is the equation for the frequency response of linear phase FIR filter when impulse
ww
response is antisymmetric and N is even.
The magnitude function is given by
w .Ea H (X )
N/2
2h 2
n 1
N 1
n sin X n
2
syE
The phase function is given by
Q N 1
H (X ) = X = C BX
ngi
2 2
where C =
Q N 1
and B = .
2 2
nee
Figure 9.6(a) shows an antisymmetric impulse response when N = 8, and Figure 9.6(b)
shows its corresponding magnitude function of frequency response. From Figure 9.6, it can
rin
be observed that the magnitude function of H(w) is symmetric with w = p when the impulse
response is antisymmetric and N is even number.
g.n
e t
Figure 9.6 (a) Antisymmetrical impulse response for N = 8, (b) Magnitude function of H(w).
www.EasyEngineering.net
www.EasyEngineering.net
ww
transform of Hd(w), which is the desired impulse response of the filter hd (n). The
Z-transform of hd(n) gives Hd(z) which is the transfer function of the desired filter. The Hd(z)
obtained from Hd(n) will be a transfer function of unrealizable non causal digital filter of
w
infinite duration. A finite duration impulse response h(n) can be obtained by truncating the
.Ea
infinite duration impulse response hd(n) to N-samples. Now, take Z-transform of h(n) to get
H(z). This H(z) corresponds to a non-causal filter. So multiply this H(z) by z–(N–1)/2 to get the
transfer function of realizable causal filter of finite duration.
syE
In window method, we begin with the desired frequency response specification Hd(w)
and determine the corresponding unit sample response hd(n). The hd(n) is given by the
inverse Fourier transform of Hd(w). The unit sample response hd(n) will be an infinite
ngi
sequence and must be truncated at some point, say, at n = N – 1 to yield an FIR filter of
length N. The truncation is achieved by multiplying hd(n) by a window sequence w(n). The
nee
resultant sequence will be of length N and can be denoted by h(n). The Z-transform of h(n)
will give the filter transfer function H(z). There have been many windows proposed like
Rectangular window, Triangular window, Hanning window, Hamming window, Blackman
wndow and Kaiser window that approximate the desired characteristics.
rin
In frequency sampling method of filter design, we begin with the desired frequency
g.n
response specification Hd(w), and it is sampled at N-points to generate a sequence H (k )
which corresponds to the DFT coefficients. The N-point IDFT of the sequence H (k ) gives
e
the impulse response of the filter h(n). The Z-transform of h(n) gives the transfer function
H(z) of the filter.
In optimum filter design method, the weighted approximation error between the desired
frequency response and the actual frequency response is spread evenly across the pass band
and evenly across the stop band of the filter. This results in the reduction of maximum error.
t
The resulting filter have ripples in both the pass band and the stop band. This concept of
design is called optimum equiripple design criterion.
The various steps in designing FIR filters are as follows:
1. Choose an ideal(desired) frequency response, Hd(w).
2. Take inverse Fourier transform of Hd (w) to get hd (n) or sample Hd (w) at finite
number of points (N-points) to get H (k ) .
3. If hd(n) is determined, then convert the infinite duration hd (n) to a finite duration
h(n) (usually h(n) is an N-point sequence) or if H (k ) is determined, then take
N-point inverse DFT to get h(n).
www.EasyEngineering.net
www.EasyEngineering.net
4. Take Z-transform of h(n) to get H(z), where H(z) is the transfer function of the
digital filter.
5. Choose a suitable structure and realize the filter.
ww H d (X ) X XT = H d (X T ) =
n
hd (n) e jX nT
w
where the Fourier coefficients hd(n) are the desired impulse response sequence of the filter.
.Ea
The samples of hd(n) can be determined using the equation:
X s /2
syE hd (n) =
1
X s Xs /2
H d (X T ) e jX nT dX
ngi
where ws is sampling frequency in rad/sec, Fs is sampling frequency in Hz. T = 1/Fs is
sampling period in sec.
nee
The impulse response hd(n) from the above equation is an infinite duration sequence.
For FIR filters, we truncate this infinite impulse response to a finite duration sequence of
length N, where N is odd. Therefore,
N 1 N 1
hd (n), for n = 2 to 2 rin
h(n) =
0, otherwise
g.n
Taking Z-transform of the above equation for h(n), we get
H (z ) =
( N 1)/2
h(n) z n
e t
n ( N 1)/2
This transfer function of the filter H(z) represents a non-causal filter (due to the presence of
positive powers of z). Hence the transfer function represented by the above equation for H(z)
is multiplied by z–(N– 1)/2. Therefore
N 1
( N 1)/2
H (z) = z 2
n = ( N 1)/2
h ( n) z n
www.EasyEngineering.net
www.EasyEngineering.net
N 1
1 (N 1)/2
=z 2
h(n) z n + h(0) + h( n) z n
n (N 1)/2 n 1
N 1
( N 1) / 2 ( N 1) / 2
=z 2
h( n) z n + h(0) + h( n) z n
n 1 n 1
ww
(N 1)/2
H ( z ) = z ( N 1)/2 h(0) + h(n) [ z n + z n ]
n 1
w Hence we see that casualty is brought about by multiplying the transfer function by the
.Ea
delay factor a = (N – 1)/2. This modification does not affect the amplitude response of the
filter, however the abrupt truncation of the Fourier series results in oscillations in the pass
syE
band and stop band. These oscillations are due to the slow convergence of the Fourier series,
particularly near the points of discontinuity. This effect is known as Gibbs phenomenon. The
undesirable oscillations can be reduced by multiplying the desired frequency response
coefficients by an appropriate window function.
ngi
Summarizing the above, the procedure for designing FIR filters by Fourier series
method is as follows:
nee
Step 1: Choose the desired frequency response Hd(w) of the filter.
Step 2: Evaluate the Fourier series coefficients of Hd(wT) which gives the desired
impulse response hd(n).
Step 3: Truncate the infinite sequence hd(n) to a finite sequence h(n).
rin
Step 4: Take Z-transform of h(n) to get a non-causal filter transfer function H(z).
g.n
Step 5: Multiply H(z) by z– (N – 1)/2 to convert the non-causal transfer function to a
realizable causal FIR filter transfer function.
EXAMPLE 9.3 Design a low-pass FIR filter with five stage. [Given: Sampling time 1 ms;
fc = 200 Hz]. Also find the frequency response of the filter.
e t
1
Solution: Given that fc = 200 Hz and f s = = 1 kHz
1 ms
The normalized cutoff frequency wc = 2p fc /fs = 2p ´ 200/1000 = 0.4p rad/sec. The given
filter can be expressed by the following specifications:
1, for X c X X c
H d (X ) = 0 , for Q X X c
0 , for X c X Q
www.EasyEngineering.net
www.EasyEngineering.net
0.4Q
1 e jX n 1 e j 0.4Q n e j 0.4Q n 1
= = = sin 0.4 Q n
2Q jn 0.4Q 2 Q jn nQ
When n ¹ 0,
1
sin 0.4p n
ww
When n = 0, the factor
1
hd(n) =
nQ
w .Ea
nQ
Hence using L’hospital rule, when n = 0, then
1
sin 0.4 Q n = 0.4
syE
hd (n) = hd (0) = Lt
n 0 nQ
The impulse response of FIR filter is obtained by truncating hd(n) to 5 samples.
So
ngi
N = 5, N – 1 = 5 – 1 = 4, and (N – 1)/2 = 2
Therefore, h(n) = hd(n) for – (N – 1)/2 £ n £ (N – 1)/2, i.e., for –2 £ n £ 2.
\ h(n) = hd(n) = 0.4; for n = 0
sin 0.4 Q n
nee
and h (n ) =
nQ
; for n 0, for 2 n 2
rin
When n = 0, h(n) = h(0) = 0.4p
g.n
When n = 1,
When n = 2,
h(n) = h(1) =
h(n) = h(2) =
sin 0.4 Q
Q
sin 2(0.4 Q )
= 0.3027 = h(–1)
= 0.0935 = h(–2)
e t
2Q
www.EasyEngineering.net
www.EasyEngineering.net
N 1 ( N 1)/2 N 1
H (X ) = e jX ( N 1)/2 h + 2h n cos X n
ww 2 n 1 2
w .Ea
= e j 2X [ h(2) + 2h(1) cos X + 2h(0) cos 2X ]
= e j 2X [0.4Q + 2(0.3027) cos X + 2h (0.0935) cos 2X ]
= e j 2X [0.4Q + 0.6054 cos X + 0.1870 cos 2X ]
syE
The magnitude function of the filter is:
ngi
|H (X )| = 0.4Q + 0.6054 cos X + 0.1870 cos 2X
nee
EXAMPLE 9.4 Design an FIR digital filter to approximate an ideal low-pass filter with
pass band gain of unity, cutoff frequency of 1 kHz and working at a sampling frequency of
fs = 4 kHz. The length of the impulse response should be 11. Use Fourier series method.
Solution:
rin
The desired frequency response of the ideal low-pass filter is given by
H d (X ) =
1 , 1000 Hz f 1000 Hz
g.n
0 , | f | 1000 Hz
The above response can be equivalently specified in terms of the normalized wc. The
normalized
e t
2Q f c 1000
Xc = = 2Q = 1.570 rad/sec
fs 4000
1, 0 |X | 1.570
H d (X ) =
0, 1.570 | X | Q
www.EasyEngineering.net
www.EasyEngineering.net
1 e jX n
1.57
1 e j1.57 n e j1.57n
= =
2Q jn 1.57 nQ 2j
1
= sin 1.57n, n 0
nQ
ww
and when n = 0, hd(n) = 0/0 is indeterminate. So when n = 0, using L’Hospital rule, we have
syE
The impulse response of FIR filter is obtained by truncating hd(n) to 11 samples. Since
N = 11, the impulse response of the filter
(N 1) (N 1)
Therefore,
h (n) = hd (n) for
2
n
2
ngi
, i.e., for –5 £ n £ 5
h(0) = 0.5
1
nee
h(1) =
Q
sin (1.57)1 = 0.318 = h( 1)
rin
h(2) =
1
2Q
sin (1.57) 2 = 0.000253 0 = h( 2)
g.n
h (3) =
h(4) =
1
3Q
1
sin (1.57) 3 = 0.1061 = h( 3)
www.EasyEngineering.net
www.EasyEngineering.net
( N 1)/2 5
H (z ) = z (N 1)/2 h(0) + h(n) [z n + z n ] = z 5 h(0) + h(n) (z n + z n )
n 1 n 1
ww
The coefficients of the realizable causal filter are:
h(0) = h(10) = 0.0636, h(1) = h(9) = 0, h(2) = h(8) = 0.1061, h(3) = h(7) = 0,
.Ea
The frequency response of the causal filter is:
N 1 ( N 1)/2 N 1
H (X ) = e jX ( N 1)/2
syEh
2
+
n 1
2 h
2
n
cos X n
ngi
= e j 5X h(5) + 2h(4) cos X + 2h(3) cos 2X + 2h(2) cos 3X + 2h(1) cos 4X + 2h(0) cos 5X
jX
e jXU ,
H d (e ) =
Xc X Xc
e t
0, Xc |X | Q
e jXU , Xc X Xc
H d (X ) =
0 , Xc |X | Q
The filter coefficients are given by
Xc Xc
1 1
hd (n) = H d (X ) e jX n dX = e jXU e jX n dX
2Q 2Q
X c X c
www.EasyEngineering.net
www.EasyEngineering.net
Xc X
1 e jX ( n U )
c
1 jX (n U )
= e dX =
2Q 2Q j (n U ) X
X c c
1 e j ( n U )Xc e j ( n U )Xc
Q (n U )
=
2j
sin (n U ) X c
= , for n U
Q (n U )
hd (U ) =
Xc , for n = U (using L’ Hospital rule)
ww
and
Q
When hd(n) = hd(– n)
w .Ea
sin (n U ) X c
Q (n U )
=
sin ( n U ) X c
syE
Table 9.1 shows the idealized frequency response and idealized impulse response of
various filters.
nee
1. Choose the desired frequency response of the filter Hd(w).
2. Take inverse Fourier transform of Hd(w) to obtain the desired impulse response
hd(n).
3. Choose a window sequence w(n) and multiply hd(n) by w(n) to convert the infinite rin
duration impulse response to a finite duration impulse response h(n).
4. The transfer function H(z) of the filter is obtained by taking Z-transform of h(n). g.n
9.6.1 Rectangular Window
The weighting function (window function) for an N-point rectangular window is given by
e t
( N 1) N 1
1, n 1, 0 n ( N 1)
wR (n) = 2 2 or wR (n) =
0, elsewhere
0, elsewhere
The spectrum (frequency response) of rectangular window WR(w) is given by the Fourier
transform of wR(n).
www.EasyEngineering.net
www.EasyEngineering.net
TABLE 9.1 The normalized ideal (desired) frequency response and impulse response for FIR filter
design using windows.
ww e jBX ; Q X X c 1
Q
H (X ) e
jX n
dX
w
hd (n) =
2Q
d
High-pass filter H d (X ) = e jBX ; X c X Q Q
.Ea 0
; Xc X Xc
=
1
2Q
X c
e
jXB jX n
e dX +
1
2Q
Q
e
jXB jX n
e dX
syE =
Q
sin (n B ) Q sin X c (n B )
Q (n B )
Xc
ngi
e jXB ; X c 2 X X c1 h (n) =
Q
nee H (X )e
1 jX n
dX
2Q
d d
e jXB ;X X X Q
c1 c2
rin
X c1 Xc 2
H d (X ) = 0 ; Q X X c2
e
Band-pass filter 1 1
= e jXB e jX n dX jXB jX n
e dX
; X c1 X X c1 2Q 2Q
0
0
;X c2 X Q
=
X c 2
sin X c2 (n B ) sin X c1 (n B )
Q (n B )
g.n Xc1
e jXB ; Q X X c2
hd (n) =
1
2Q
Q
H (X )e d
jX n
dX
e t
e jXB ; X c1 X X c1 Q
X c 2 Xc1
Band-stop filter H d (X ) = e jXB ;X c 2 X Q
1 1
= e jXB jX n
e dX + e jXB e jX n dX
0 ; X c2 X X c1 2Q 2Q
Q Xc1
0 ; X c1 X X c 2
Q
e
1
+ jXB jX n
e dX
2Q
Xc 2
www.EasyEngineering.net
www.EasyEngineering.net
N 1
(N 1)/2 N 1 jX n
jX n 2
WR (X ) = e = e
n (N 1)/2 n0
N 1 N 1 N 1 N 1
jX jX
jX n
= e e 2 =e 2
e jX n
n=0 n0
N 1
jX
2
1 e jX N
=e jX
1 e
ww e
j
XN
2
j
XN j
e 2 e 2
XN
w .Ea
=e
j
XN
2 e
j
X
2
j
X jX X
j
e 2 e 2 e 2
syE j
XN
e
j
XN
sin
XN
ngi
e 2 2
= = 2
j
X j
X
sin
X
e 2 e 2
2
nee
The frequency spectrum for N = 31 is shown in Figure 9.7. The spectrum WR(w) has two
rin
features that are important. They are the width of the main lobe and the side lobe amplitude.
The frequency response is real and its zero occurs when w = 2kp /N where k is an integer.
The response for w between –2p /N and 2p /N is called the main lobe and the other lobes are
called side lobes. For rectangular window the width of main lobe is 4p/N. The first side lobe
will be 13 dB down the peak of the main lobe and the roll off will be at 20 dB/decade. As g.n
the window is made longer, the main lobe becomes narrower and higher, and the side lobes
become more concentrated around w = 0, but the amplitude of side lobes is unaffected. So
increase in length does not reduce the amplitude of ripples, but increases the frequency when
rectangular window is used.
e t
If we design a low-pass filter using rectangular window, we find that the frequency
response differs from the desired frequency response in many ways. It does not follow quick
transitions in the desired response. The desired response of a low-pass filter changes abruptly
from pass band to stop band, but the actual frequency response changes slowly. This region
of gradual change is called filter’s transition region, which is due to the convolution of the
desired response with the window response’s main lobe. The width of the transition region
depends on the width of the main lobe. As the filter length N increases, the main lobe
becomes narrower decreasing the width of the transition region.
The convolution of the desired response and the window response’s side lobes gives
rise to the ripples in both the pass band and stop band. The amplitude of the ripples is
www.EasyEngineering.net
www.EasyEngineering.net
ww
w .Ea
syE
ngi
nee
rin
g.n
e t
Figure 9.7 (a) Rectangular window sequence, (b) Magnitude response of rectangular window,
(c) Magnitude response of low-pass filter approximated using rectangular window.
dictated by the amplitude of the side lobes. This effect, where maximum ripple occurs just
before and just after the transition band, is known as Gibb’s phenomenon.
The Gibbs phenomenon can be reduced by using a less abrupt truncation of filter
coefficients. This can be achieved by using a window function that tapers smoothly towards
zero at both ends.
www.EasyEngineering.net
www.EasyEngineering.net
2| n | N 1 N 1
1 N 1, for n
wT (n) = 2 2
0 , otherwise
1 2 n ( N 1) / 2 , 0 n N 1
ww
or
wT (n) =
0
N 1
, otherwise
w .Ea
In magnitude response of triangular window, the side lobe level is smaller than that of
the rectangular window being reduced from –13 dB to –25 dB. However, the main lobe
width is now 8p/N or twice that of the rectangular window.
syE
The triangular window produces a smooth magnitude response in both pass band and
stop band, but it has the following disadvantages when compared to magnitude response
obtained by using rectangular window:
1. The transition region is more.
2. The attenuation in stop band is less. ngi
nee
Because of these characteristics, the triangular window is not usually a good choice.
2Q n N 1 N 1
e t
B + (1 B ) cos , for n
wH (n) = N 1 2 2
0, elsewhere
www.EasyEngineering.net
www.EasyEngineering.net
2Q n N 1 N 1
0.5 + 0.5 cos , for n
wHn (n) = N 1 2 2
0 , otherwise
The width of main lobe is 8p/N, i.e., twice that of rectangular window which results in
ww
doubling of the transition region of the filter. The peak of the first side lobe is –32 dB
relative to the maximum value. This results in smaller ripples in both pass band and stop
band of the low-pass filter designed using Hanning window. The minimum stop band
w
attenuation of the filter is 44 dB. At higher frequencies the stop band attenuation is even
.Ea
greater. When compared to triangular window, the main lobe width is same, but the
magnitude of the side lobe is reduced, hence the Hanning window is preferable to triangular
syE
window.
www.EasyEngineering.net
www.EasyEngineering.net
2Q n 4Q n N 1 N 1
0.42 + 0.5 cos N 1 + 0.08 cos N 1 , for 2 n 2
wB (n) =
0 , otherwise
2nQ 4nQ
0.42 0.5 cos N 1 + 0.08 cos N 1 , 0 n N 1
or w B ( n) =
ww
0 , otherwise
In the magnitude response, the width of the main lobe is 12p/N, which is highest among
w
windows. The peak of the first side lobe is at –58 dB and the side lobe magnitude decreases
.Ea
with frequency. This desirable feature is achieved at the expense of increased main lobe
width. However, the main lobe width can be reduced by increasing the value of N. The side
syE
lobe attenuation of a low-pass filter using Blackman window is –78 dB.
Table 9.2 gives the important frequency domain characteristics of some window functions.
Type of
TABLE 9.2
Approximate ngi
Frequency domain characteristics of some window functions.
EXAMPLE 9.6
12p/N –78
e
–58
www.EasyEngineering.net
www.EasyEngineering.net
Q Q
1, for X
2 2
H d (X ) =
0, Q
for |X | Q
2
ww =
1
2Q
Q /2
(1) e jX n dX =
1 e jX n 2
2Q jn Q
Q
w .Ea
Q /2
j nQ
1 e 2 e 2
j
nQ
2
syE
=
nQ 2j
=
1
nQ
sin
nQ
2
ngi
for n 0
and hd (n) =
1
2 nee
for n = 0 [using L’Hospital rule]
\ hd (0) =
1
, hd (1) =
1
Q
sin
Q
rin
=
1
Q
= hd ( 1)
2
1
sin Q = 0 = hd ( 2),
1 3Q
2
1 g.n
hd (2) =
hd (4) =
2Q
1
sin 2Q = 0 = hd ( 4),
hd (3) =
hd (5) =
3Q
1
sin
sin
2
5Q
=
=
1
3Q
e
= hd ( 3)
= hd ( 5)
t
4Q 5Q 2 5Q
1, for 5 n 5
w(n) =
0, otherwise
www.EasyEngineering.net
www.EasyEngineering.net
1 1 1
h(0) = , h(1) = = h( 1), h(2) = 0 = h( 2), h(3) = = h( 3),
2 Q 3Q
1
h(4) = 0 = h( 4), h(5) = = h( 5)
5Q
The above coefficients correspond to a non-causal filter which is not realizable.
The realizable digital filter transfer function H(z) is given by
( N 1)/2
ww
5
H ( z ) = z ( N 1)/2 h(0) + h(n) [ z n + z n ] = z 5 h(0) + h (n )[ z n
+ z n
]
n 1 n 1
.Ea
= h(5) + h(3) z 2 + h(1) z 4 + h(0) z 5 + h(1) z 6 + h(3) z 8 + h(5)z 10
=
1
5Q
syE
1 2
3Q
1
Q
1
2
1
z + z 4 + z 5 + z 6
Q
1 8
3Q
z +
1 10
5Q
z
ngi
Therefore, the coefficients of the realizable digital filter are:
nee
1 1
h(0) = h(10), h(1) = 0 = h(9), h(2) = = h(8),
5Q 3Q
1 1
h(3) = 0 = h(7), h(4) =
Q
= h(6), h(5) =
2
rin
EXAMPLE 9.7
response:
A low-pass filter is to be designed with the following desired frequency
g.n
j 2X
e
H d (e jX ) =
0,
,
Q
4
Q
X
Q
4 e t
|X | Q
4
Determine the filter coefficients h(n) if the window function is defined as:
1 , 0 n 4
w(n) =
0, otherwise
Also determine the frequency response H(e jw) of the designed filter.
www.EasyEngineering.net
www.EasyEngineering.net
j 2X Q Q
e , X
4 4
H d (X ) =
0, Q
|X | Q
4
The filter coefficients are given by
Q
1
H d (X ) e dX
jX n
hd (n) =
2Q
ww 1
Q
Q /4
e j 2X e jX n dX =
1
Q /4
e jX ( n 2) dX
w
=
2Q 2Q
Q /4 Q /4
.Ea jX ( n 2) Q /4
j ( n 2) Q
e e
j ( n 2)
Q
syE 1 e 1 4 4
= =
2Q j ( n 2) Q /4 Q (n 2) 2j
=
1
Q (n 2)
Q
sin (n 2) , n 2.
4 ngi
nee
For n = 2, the filter coefficient can be obtained by applying L’Hospital rule to the above
expression. Thus,
sin (n 2)
Q
4 = 1 .Q = 1 rin
g.n
1
hd (2) = Lt
n 2 Q (n 2) Q 4 4
Since it is a linear phase filter, the other filter coefficients are given by
hd (0) =
1
Q (0 2)
Q
sin (0 2) =
4
1
2Q
e t
1 Q 1
hd (1) = sin (1 2) =
Q (1 2) 4 2Q
1 Q 1
hd (3) = sin (3 2) =
Q (3 2) 4 2Q
1 Q 1
hd (4) = sin (4 2) =
Q (4 2) 4 2Q
www.EasyEngineering.net
www.EasyEngineering.net
The filter coefficients of the filter using rectangular window would be then
h(n) = hd(n) . w(n) = hd(n)
1 1 1
Therefore, h(0) = = h (4), h(1) = = h(3), and h(2) =
2Q 2Q 4
N 1
H (z ) = h(n) z n = h(0) + h(1) z 1 + h(2) z 2 + h(3) z 3 + h(4) z 4
ww =
n0
1
+
1
z 1 + 0.25 z 2 +
1
z 3 +
1 4
z
w .Ea
2Q
= z 2 0.25 +
2Q
1
2Q
(z + z 1 ) +
2Q
1 2
2Q
2Q
( z + z 2 )
H (X ) =
syE
The frequency response H(w) of the digital filter is given by
4
h(n) e jX n
n0
ngi
nee
= h(0) + h(1) e jX + h(2) e j 2X + h(3) e j 3X + h(4) e j 4X
= e j 2X [h(0) e j 2X + h(1) e jX + h(2) + h(3) e jX + h(4) e j 2X ]
rin
= e j 2X [ h(2) + h(1) (e jX + e jX ) + h(0) (e j 2X + e j 2X )]
1
= e j 2X +
4 Q
2 1
cos X + cos2X
Q
g.n
EXAMPLE 9.8 A filter is to be designed with the following desired frequency response. e t
Q Q
0, X
2 2
H d (e jX ) =
e j 2X , Q | X | Q
2
Determine the filter coefficient h(n), if the window function is defined as
1, 0n4
w(n) =
0, otherwise
Also determine the frequency response H(ejw) of the designed filter.
www.EasyEngineering.net
www.EasyEngineering.net
Q Q
0, X
2 2
H d (X ) =
e j 2X , Q |X | Q
2
the filter coefficients are given by
Q
1
H d (X ) e dX
jX n
hd (n) =
2Q
ww 1
Q
Q /2
j 2X jX n
dX
1
Q
e j 2X e jX n dX
w =
.Ea
=
2Q
1
Q
Q /2
e e
e jX ( n 2) dX +
+
1
2Q
Q
Q /2
e jX ( n 2) dX
2Q 2Q
syE Q
1 e jX ( n 2)
Q /2
Q /2
1 e jX ( n 2)
Q
=
2Q j (n 2) Q
+
ngi
2Q j ( n 2) Q /2
=
1 j ( n 2) Q
e
j 2Q (n 2) nee
2 e j ( n 2)Q + e j ( n 2)Q e
Q
j ( n 2)
2
1
e j ( n 2)Q e j ( n 2) Q
j ( n 2) Q
e 2 e
j ( n 2)
Q
2 rin
=
Q (n 2)
2j
2j
g.n
=
1
Q (n 2)
Q
sin (n 2) Q sin ( n 2) ,
2
n2 e t
For n = 2, hd(n) is indeterminate. So using L’Hospital rule, we have
www.EasyEngineering.net
www.EasyEngineering.net
1 Q 1
hd (1) =
Q (1 2) sin (1 2) Q sin (1 2) 2 = Q
1 Q 1
hd (3) =
Q (3 2) sin (3 2) Q sin (3 2) 2 = Q
1 Q
hd (4) =
Q (4 2) sin (4 2) Q sin (4 2) 2 = 0
Since h(n) = hd(n) . w(n), applying the window function, the new filter coefficients are:
ww h(0) = 0, h(1) =
1
Q
, h(2) =
1
2
1
, h(3) = , and h(4) = 0
Q
w
The transfer function of the filter is:
.Ea N 1
H (z) = h ( n) z n
syE n0
=0
1
Q
z 1 +
1 2
2
z
ngi
1 3
Q
z +0
1 1
= z 2 ( z + z 1 )
2 Q
nee
The frequency response H(w) is given by rin
H (X ) =
4
1 1 jX
= e j 2X (e + e jX )
2 Q
1
= e j 2X
2
cos X
2 Q
www.EasyEngineering.net
www.EasyEngineering.net
j 3X Q Q
e , X
jX 4 4
H d (e ) =
0 Q
, |X | Q
4
j 3X Q Q
ww e
H d (X ) =
0
,
4
Q
X
4
w .Ea
the filter coefficients are given by
Q
,
4
|X | Q
Q /4
syE
hd (n) =
1
2Q
Q
H d (X ) e jX n dX =
1
2Q
Q /4
e j 3X e jX n dX
=
1
2Q
Q /4
e jX ( n 3)
dX
ngi =
1 e jX ( n 3)
2Q j ( n 3) Q /4
Q /4
=
1
Q /4
nee
e jQ ( n 3)/4 e jQ ( n 3)/4
Q (n 3) 2j
rin
=
sin Q (n 3)/4
Q (n 3)
, n 3
g.n
For n = 3, the filter coefficient can be obtained by applying L’Hospital’s rule to the above
expression. Thus,
sin
1
( n 3) Q
e t
4 1
hd (3) = Lt =
n 3 sin(n 3) Q 4
www.EasyEngineering.net
www.EasyEngineering.net
0.707 1 0.707
hd (4) = , hd (5) = , hd (6) =
Q 2Q 3Q
ww
The Hamming window function of a causal filter is:
2Q n
0.54 0.46 cos N 1 , 0 n N 1
w .Ea
Therefore, with N = 7
w( n) =
0 , otherwise
syE
w(0) = 0.54 – 0.46 cos 0 = 0.08, w(1) = 0.54 0.46 cos
2Q 1
7 1
= 0.31
e
The filter coefficients of the resultant filter are:
Therefore,
h(n) = hd(n) w(n),
0.707
n = 0, 1, 2, 3, 4, 5, 6
1
t
h (0) = hd (0) w(0) = 0.08 = 0.006 , h (1) = hd (1) w(1) = 0.31 = 0.049
3Q 2Q
0.707 1 1
h(2) = hd (2) w(2) = 0.77 = 0.173 , h(3) = hd (3) w(3) = 1 = = 0.25
Q 4 4
0.707 1
h (4) = hd (4) w(4) = 0.77 = 0.173 , h (5) = hd (5) w(5) = 0.31 = 0.049
Q 2Q
0.707
h (6) = hd (6) w(6) = 0.08 = 0.006
3Q
www.EasyEngineering.net
www.EasyEngineering.net
ww
The transfer function of the digital FIR low-pass filter is:
w H (z ) =
N 1
h ( n) z n
n0
.Ea
= h(0) + h(1) z 1 + h(2) z 2 + h(3) z 3 + h(4) z 4 + h (5) z 5 + h (6) z 6
syE
= z 3 h(3) + h(2) ( z 1 + z ) + h(1) ( z 2 + z 2 ) + h(0) (z 3 + z 3 )
ngi
= z 3 0.25 + 0.173 [ z + z 1 ] + 0.049 [ z 2 + z 2 ] + 0.006 [z 3 + z 3 ]
nee
EXAMPLE 9.10 Design a digital FIR low-pass filter using rectangular window by taking 9
samples of w(n) and with a cutoff frequency of 1.2 rad/sec.
Solution: Cutoff frequency of given low-pass filter wc = 1.2 rad/sec and N = 9. For a low- rin
pass filter, the desired frequency response is
g.n
e jXB ,
H d (X ) =
0 ,
Xc X Xc
otherwise
The desired impulse response is obtained by taking the inverse Fourier transform of Hd(w).
e t
Therefore,
Q Xc
1 1
hd (n) = H d (X ) e jX n dX = e jXB e jX n dX
2Q 2Q
Q X c
Xc X
1 1 e jX ( n B ) c
= e jX ( nB ) dX =
2Q 2Q j ( n B ) X c
X c
www.EasyEngineering.net
www.EasyEngineering.net
1 e j ( n B )Xc e j ( n B )Xc
=
Q (n B ) 2j
1
= sin (n B )X c for n B
Q (n B )
sin (n B ) X c
and for n = a, is 0/0, which is indeterminate. Using L’hospital rule, we have
Q (n B )
sin (n B ) X c Xc
for n = a, H d (B ) = Lt = .
Q (n B ) Q
ww n B
The impulse response of FIR filter h(n) is obtained by multiplying hd(n) by the window
sequence. Therefore, Impulse response h(n) = hd(n) . wR(n).
w .Ea
1,
Rectangular window sequence, wR (n) =
0,
for 0 n N 1
otherwise
\
syE h(n) = hd(n);
ngi
= = =4
2 2
sin ( n 4) 1.2
Therefore, we have h( n) =
Q (n 4)
,
nee for n 4
rin
Therefore,
sin (0 4)1.2 sin (1 4)1.2
h(0) = = 0.0793, h(1) = = 0.0470
Q (0 4)
sin (2 4)1.2
Q (1 4)
sin (3 4)1.2 g.n
h(2) =
h(4) =
Xc
Q
Q (2 4)
=
1.2
Q
= 0.1075 ,
= 0.382,
h(3) =
h(5) =
Q (3 4)
sin (5 4)1.2
Q (5 4)
= 0.2967
= 0.2967
e t
sin (6 4)1.2 sin (7 4)1.2
h(6) = = 0.1075 , h(7) = = 0.047
Q (6 4) Q (7 4)
sin (8 4)1.2
h(8) = = 0.0793
Q (8 4)
Here we can observe that h(0) = h(8), h(1) = h(7), h(2) = h(6) and h(3) = h(5), i.e., the
impulse response is satisfying the symmetry condition h(N – 1 – n) = h(n).
www.EasyEngineering.net
www.EasyEngineering.net
w .Ea
N 1 ( N 1)/2 N 1
H (X ) = e jX ( N 1)/2 h
2
+ 2h
n 1 2
n cos X n
syE 4
= e j 4X h(4) + 2h(4 n) cos X n
n 1
ngi
= e j 4X {h(4) + 2 h(3) cos X + 2h(2) cos 2X + 2 h(1) cos 3X + 2h(0) cos 4X}
=e j 4X
rin
= e j 4X {0.382 + 0.5934 cos X + 0.215 cos 2 X 0.094 cos 3 X 0.1586 cos 4 X}
The magnitude response is:
0 , Xc X Xc
H d (X ) =
jXB
e , X c |X | Q
The desired impulse response hd(n) is obtained by taking the inverse Fourier transform of
Hd(w).
www.EasyEngineering.net
www.EasyEngineering.net
Xc Q
1 1
= e jX ( n B ) dX + e
jX ( n B )
dX
2Q 2Q
Q Xc
X Q
1 e jX ( n B ) 1 e jX ( n B )
c
= +
2Q j (n B ) Q 2Q j( n B ) X
c
ww =
1
2Q
e j ( n B )X c e j ( n B )Q + e j ( n B )Q e j ( n B )Xc
j( n B )
w .Ea
=
1
Q (n B )
e j ( n B ) Q e j ( n B ) Q
2j
e j ( n B )X c e j ( n B )Xc
2j
=
syE 1
Q (n B )
{sin (n B )Q sin (n B ) X c }
www.EasyEngineering.net
www.EasyEngineering.net
Therefore,
ww hd (6) =
Q (6 4)
sin (8 4) 1.2
= 0.1075, hd (7) =
Q (7 4)
= 0.0469
w hd (8) =
.Ea
Q (8 4)
= 0.0792
syE 2Q n
wH ( n) = 0.54 0.46 cos
N 1
; for n = 0 to N 1
Therefore,
ngi
2Q 0
wH (0) = 0.54 0.46 cos
nee
9 1
= 0.08
2Q 1
wH (1) = 0.54 0.46 cos
9 1
= 0.2147
rin
2Q 2
wH (2) = 0.54 0.46 cos
9 1
= 0.54
g.n
2Q 3
wH (3) = 0.54 0.46 cos
9 1
= 0.8652 e t
2Q 4
wH (4) = 0.54 0.46 cos =1
9 1
2Q 5
wH (5) = 0.54 0.46 cos = 0.8652
9 1
2Q 6
wH (6) = 0.54 0.46 cos = 0.54
9 1
www.EasyEngineering.net
www.EasyEngineering.net
2Q 7
wH (7) = 0.54 0.46 cos = 0.2147
9 1
2Q 8
wH (8) = 0.54 0.46 cos = 0.08
9 1
The filter coefficients are h(n) = hd(n)wH(n)
.Ea
h(5) = hd (5) wH (5) = 0.2966 0.8652 = 0.2566
h(6) = hd (6) wH (6) = 0.1075 0.54 = 0.0580
syE
h(7) = hd (7) wH (7) = 0.0469 0.2147 = 0.0100
h(8) = hd (8) wH (8) = 0.0792 0.08 = 0.0063
ngi
From the above calculations, we can observe that h(N – 1 – n) = h(n), i.e., the impulse
nee
response is symmetrical with centre of symmetry at n = 4. The frequency response of the
filter is:
H (X ) =
N 1
h(n) e jX n
rin
g.n
n0
t
0.618 + 2( 0.256)cos X + 2( 0.058) cos 2X + 2(0.010) cos 3X
= e j 4X
+ 2(0.0063) cos 4X
www.EasyEngineering.net
www.EasyEngineering.net
N 1 8
H ( z) = h(n) z n = h(n) z n
n0 n0
1
= h(0) + h(1) z + h(2) z 2 + h(3) z 3 + h(4) z 4 + h(5) z 5 + h(6) z 6 + h(7) z 7 + h(8) z 8
= 0.0063 + 0.010 z 1 0.0580 z 2 0.2566 z 3 + 0.618 z 4 0.2566 z 5
0.0580 z 6 + 0.0100 z 7 + 0.0063 z 8
= z 4 [0.618 0.2566(z + z 1 ) 0.0580 (z 2 + z 2 ) + 0.0100 (z 3 + z 3 ) + 0.0063(z 4 + z 4 )]
ww
EXAMPLE 9.12 Design a band-pass filter to pass frequencies in the range 1 to 2 rad/sec.
w
using Hanning window, with N = 5.
Solution:
.Ea
The desired frequency response Hd(w) for band pass filter is:
ngi
The band-pass filter has to pass frequencies in the range 1 to 2 rad/sec.
Therefore, wc1 = 1 and wc2 = 2. The desired impulse response hd(n) is obtained by
taking inverse Fourier transform of Hd(w).
\
1
Q
Hd (X ) e
jX n
dX
nee
hd ( n) =
2Q
Q
rin
=
1
2Q
X c1
e jXB e jX n dX +
1
2Q
Xc2
e jXB e jX n dX
g.n
e
Xc2 Xc1
=
1
2Q
1
e
2
jX ( n B )
dX +
1
2Q
2
e
1
jX ( n B )
dX t
1 2
1 e jX ( n B ) 1 e jX ( n B )
= +
2Q j ( n B ) 2 2Q j (n B ) 1
1 e j 2( n B ) e j 2( n B ) e j ( n B ) e j ( n B )
=
Q (n B ) 2j 2j
1
=
Q (n B )
sin 2(n B ) sin (n B )
www.EasyEngineering.net
www.EasyEngineering.net
1
Hence, hd ( n) = [ sin 2( n B ) sin( n B )] ; for n ¹ a
Q (n B )
sin 2(n B ) sin (n B )
When n = a, the terms and become 0/0 which is indeterminate.
Q (n B ) Q (n B )
Hence using L’ Hospital rule, we get when n = a
1 sin 2( n B ) sin (n B ) 1 1
hd ( n) = Lt = [2 1] =
n B Q (n B ) (n B ) Q Q
ww
Here,
Therefore, we have
B= N 1 5 1
2
=
2
=2
w hd (0) =
sin 2(0 2) sin (0 2)
.EaQ (0 2)
= 0.2651 , hd (1) =
sin 2(1 2) sin(1 2)
Q (1 2)
= 0.0215
hd (4) =
Q (4 2)
= 0.2651
ngi
The Hanning window sequence is given by w( n) = 0.5 0.5 cos
nee
2Q n
N 1
; for n = 0 to N – 1.
Therefore, we have
2Q 0 2Q 1
w(1) = 0.5 0.5cos rin
w(0) = 0.5 0.5cos
5 1
=0, 5 1
= 0.5
2Q 3
g.n
2Q 2
w(2) = 0.5 0.5cos
5 1
= 1,
2Q 4
w(4) = 0.5 0.5cos =0
w(3) = 0.5 0.5cos
5 1
= 0.5
e t
5 1
Therefore, the filter coefficients are h(n) = hd(n) w(n). Hence, we have
www.EasyEngineering.net
www.EasyEngineering.net
i.e., h(0) = 0, h(1) = 0.0108, h(2) = 0.3183, h(3) = 0.0108, and h(4) = 0
From the above filter coefficients, it can observed that the impulse response is symmetrical
with centre of symmetry at n = 2. The frequency response is given by
N 1
H (X ) = h(n) e jXn
n0
w .Ea
The magnitude response is given by
syE
The transfer function of the digital FIR band-pass filter is
N 1
ngi
4
H ( z) = h ( n) z n = h ( n) z n
n0 n0
= h(0) + h(1) z 1
nee
+ h(2) z 2 + h(3) z 3 + h(4) z 4
= 0.0108 z 1 + 0.3183 z 2 + 0.0108 z 3
rin
g.n
EXAMPLE 9.13 Design a band-stop filter to reject frequencies in the range 1 to 2 rad/sec
using rectangular window, with N = 7.
Solution: The desired frequency response for band stop filter is:
e jXB ,
H d (X ) =
0 ,
Q X X c 2 and X c1 X X c1 and X c 2 X Q
otherwise
e t
The desired impulse response hd(n) is obtained by taking inverse Fourier transform of Hd(w).
Q
1
H d (X ) e dX
jX n
hd ( n) =
2Q
Q
Xc Xc1 Q
1 2 jXB jX n
2Q
= e e dX + e jXB e jX n dX + e jXB jX n
e d X
Q X c1 Xc 2
www.EasyEngineering.net
www.EasyEngineering.net
X c2 Xc1 Q
1 1 1
= e jX ( n B )
dX + e jX ( n B ) dX + e jX ( n B ) dX
2Q 2Q 2Q
Q X c1 X c2
X X Q
1 e jX ( n B ) 2 1 e jX ( n B ) 1 1 e jX (n B )
c c
= + +
2Q j (n B ) Q 2Q j (n B ) X 2Q j ( n B ) X
c1 c2
1
= e j ( n B )X c e j ( n B ) Q + e j ( n B )X c e j ( n B )Xc + e j ( n B )Q e j ( n B )X c
2Q j( n B ) 2 1 1 2
e j ( n B ) X c e j ( n B ) X c e j ( n B )Q e j ( n B ) Q
ww =
1
Q (n B )
1
2j
1
+
2j
e j ( n B )X c2 e j ( n B )X c2
w =
1
Q (n B )
[ sin (n B ) X c1 + sin (n B ) Q sin (n B )X c 2 ]
is indeterminate.
the terms
syE n B
,
n B
and
n B
become 0/0, which
Hence, hd ( n) =
1
Q (n B ) ngi
[ sin(n B )X c1 + sin(n B )Q sin ( n B )X c 2 ] for n ¹ a
When n = a, using L’Hospital rule, we have
1 sin ( n B )X c1 sin ( n B )Q
neesin ( n B )X c 2
hd ( n) = Lt
n B Q (n B )
+
(n B )
(n B )
rin
=
Q
1
[X c1 + Q
X X c1
X c2 ] = 1 c2
Q g.n
\ X X c1
hd ( n) = 1 c 2
Q
for n = B e t
The rectangular window sequence wR(n) is given by
1, for 0 n N 1
wR (n) =
0 , otherwise
Therefore, the filter coefficients are h(n) = hd(n) . wR(n) = hd(n). Given that the order of the
filter N = 7.
N 1 7 1
\ B = = =3
2 2
www.EasyEngineering.net
www.EasyEngineering.net
Since both n and a are integers, (n – a) is also an integer, so sin (n – a)p = 0. Also we
are given that wc2 = 2 rad/sec and wc1 = 1 rad/sec. Therefore, we have for n = 3.
(X c2 X c1 ) (2 1) 1
h(n) = hd (n) = 1 =1 =1
Q Q Q
and for n ¹ 3
1 sin (n 3) sin 2( n 3)
h( n) = hd ( n) = [ sin (n B )X c1 sin ( n B )X c 2 ] =
( n B )Q ( n 3)Q
ww h(0) =
sin (0 3) sin 2(0 3)
(0 3)Q
= 0.0446, h(1) =
sin (1 3) sin 2(1 3)
(1 3)Q
= 0.2652
w h(2) =
sin (2 3) sin 2(2 3)
.Ea
(2 3)Q
sin (4 3) sin 2(4 3)
1
= 0.0216, h(3) = 1 = 0.6817
Q
sin (5 3) sin 2(5 3)
h(4) =
syE
(4 3)Q
sin (6 3) sin 2(6 3)
= 0.0216, h(5) =
(5 3)Q
= 0.2652
h(6) =
(6 3)Q
= 0.0446
ngi
h(5) = 0.2652, h(6) = 0.0446.
Observing the values of h(n), we can note that nee
That is h(0) = 0.0446, h(1) = 0.2652, h(2) = – 0.216, h(3) = 0.6817, h(4) = – 0.0216,
h(n) e jX n =
n 0
jX
6
h(n)e jX n
n 0
j 2X j 3X j 4X
e
j 5X j 6X
t
= h(0) + h(1) e h(2) e + h(3) e + h(4) e + h(5) e + h(6) e
= e j 3X [ h(0) e j 3X + h(6) e j 3X + h(1) e j 2X + h(5) e j 2X + h(2) e jX + h(4) e jX + h(3)]
= e j 3X [ h(3) + 2h(0) cos 3X + 2h(1) cos 2X + 2h(2) cos X ]
= e j 3X [0.6817 + 0.0892 cos 3X + 0.5304 cos 2X 0.0432 cos X ]
The magnitude response is:
www.EasyEngineering.net
www.EasyEngineering.net
ww
EXAMPLE 9.14
Cutoff frequency
Design a high-pass FIR filter for the following specifications:
= 500 Hz
Sampling frequency = 2000 Hz
w N = 11
.Ea
Solution: Given fc = 500 Hz and fs = 2000 Hz
Normalized cutoff frequency is:
syE Xc =
2Q fc
fs
=
2Q 500
2000
Q
= rad/sec
2
Q
H d (X ) e jX n dX =
1
2Q
Q /2
Q
H d (X ) e jX n dX +
1
2Q
Q
Hd (X ) e
Q /2
e
jX n
dX
t
Q /2 Q Q /2 Q
e jX n e jX n
(1) e jX n dX + (1) e jX n dX =
1 1 1 1
=
2Q 2Q 2Q
jn Q
+
2Q
jn Q /2
Q Q /2
j nQ j
nQ
1 e 2 e jnQ e jnQ e 2
= +
2Q jn jn
www.EasyEngineering.net
www.EasyEngineering.net
nQ nQ
j j
1 e jnQ e jnQ e 2 e 2
=
nQ 2j 2j
nQ nQ
sin sin
sin nQ 2 = 2
=
nQ nQ nQ
Knowing hd(n), using standard procedure, we can design the required high-pass FIR filter
with N = 11.
ww
EXAMPLE 9.15 Design a band-pass FIR filter for the following specifications:
Cutoff frequencies = 400 Hz and 800 Hz
w
Sampling frequency = 2000 Hz
Solution: .Ea
N = 11
Given cutoff frequencies are:
X c1 = 2Q fc1
ngi
2Q 400
fs
=
2000
nee
= 0.4 Q
and Xc2 =
2Q fc 2
fs
=
2Q 800
2000
= 0.8 Q
rin
The desired frequency response is:
g.n
H d (X ) =
1,
0,
X c 2 X X c1 and X c1 X X c 2
otherwise (i.e. Q X X c2 , X c1 X X c1 and X c 2 X Q ) e t
1, 0.8Q X 0.4Q and 0.4Q X 0.8Q
i.e. H d (X ) =
0, Q X 0.8Q , 0.4Q X 0.4Q , 0.8Q X Q
H d (X ) e dX
1 jX n
hd ( n) =
2Q
Q
0.4 Q 0.8Q
1 1
jX n
= (1) e dX + (1) e jX n dX
2Q 2Q
0.8Q 0.4Q
www.EasyEngineering.net
www.EasyEngineering.net
0.4Q 0.8Q
1 e jX n 1 e jX n
= +
2Q jn 0.8Q 2Q jn 0.4Q
ww =
nQ
nQ
w
Knowing hd(n) using standard procedure we can design the required band-pass FIR filter
with n = 11.
.Ea
EXAMPLE 9.16 Design an FIR band-stop (band reject or band elimination or notch) filter
syE
for the following specifications.
Cutoff frequencies = 400 Hz and 800 Hz
Sampling frequency = 2000 Hz
Solution:
N = 11
Given cutoff frequencies are ngi
fc1 = 400 Hz and
neefc2 = 800 Hz
rin
Sampling frequency is fs = 2000 Hz
The normalized cutoff frequencies are:
X c1 =
2Q fc1
fs
=
2Q 400
2000
= 0.4 Q
g.n
and Xc2 =
2Q fc 2
fs
=
2Q 800
2000
= 0.8 Q e t
The desired frequency response is:
1, Q X X c 2 , X c1 X X c1 and X c 2 X Q
H d (X ) =
0, otherwise (i.e X c 2 X X c1 and X c1 X X c2 )
www.EasyEngineering.net
www.EasyEngineering.net
1
0.8Q 0.4Q Q
(1) e jX n dX + (1) e jX n dX + jX n
2Q
= (1) e d X
Q 0.4Q 0.8Q
0.8Q 0.4Q Q
1 e jX n e jX n e jX n
= + +
2Q jn Q jn 0.4Q jn 0.8Q
ww =
1
w =
.Ea 1
nQ
e jnQ e jnQ
2j
e j 0.8 nQ e j 0.8 nQ
2j
+
e j 0.4 nQ e j 0.4 nQ
2j
= syE
1
nQ
[sin nQ sin (0.8 nQ ) + sin (0.4 nQ )]
=
1
nQ
[sin (0.4 nQ ) sin (0.8 nQ )]
ngi
nee
Knowing hd(n), using standard procedure, we can design the required band-reject filter with
N = 11.
www.EasyEngineering.net
www.EasyEngineering.net
controlled with respect to the main lobe peak by varying a parameter a. The width of the
main lobe can be varied by adjusting the length of the filter. The Kaiser window function is
given by
I 0 (C ) N 1
I (B ) , for | n | 2
wk ( n) = 0
0 , otherwise
ww 2n 2
C = B 1
2
N 1
w
The modified Bessel function of the first kind, I0(x) can be computed from its power series
expansion given by
.Ea
syE
2
1 x k
I 0 ( x) = 1 +
k ! 2
k 1
=1+
0.25 x 2
(1!)2
+
(2!) 2 ngi
(0.25 x 2 )2
+
(0.25 x 2 )3
(3!)3
+ ...
nee
Figure 9.8 shows the idealized frequency responses of different filters with their pass band
and stop band specifications. Considering the design specifications of the filters in Figure 9.8,
the actual pass band ripple (ap) and minimum stop band attenuation (as) are given by
rin
B p = 20 log10
1 + Ep
1 Ep
dB
g.n
and
The transition bandwidth is
as = –20 log10 as dB
e t
DF = fs – fp
Let a ¢p and a ¢s be the specified pass band ripple and minimum stop band attenuation,
respectively and
a p £ a ¢p
a s £ a ¢s
where a p and a s are the actual pass band peak to peak ripple and minimum stop band
attenuation respectively.
www.EasyEngineering.net
www.EasyEngineering.net
ww
w .Ea
syE
Figure 9.8 ngi
Idealized frequency responses: (a) low-pass filter, (b) high-pass filter, (c) band pass filter
and (d) band stop filter.
nee
Design specifications
1. Filter type; low-pass, high-pass, band pass or band stop rin
2. Pass band and stop band frequencies in hertz
For low-pass/high-pass: fp and fs g.n
For band pass/band stop: fp1, fp2, fs1, fs2
3. Pass band ripple and minimum stop band attenuation in positive dB;
4. Sampling frequency in hertz: F
5. Filter order N-odd
e a ¢p and a ¢s
t
Design procedure
1. Determine hd(n) for an ideal frequency response H(w)
2. Choose d according to equations
1 + Ep
B p = 20 log10 dB and B s = 20 log E s dB
1 Ep
and B p B p and B s B s
www.EasyEngineering.net
www.EasyEngineering.net
0.05B p
– 0.05 a ¢s 10 e 1
where ds = 10 e and E p = 0.05 B p
10 e +1
3. Calculate as using the formula
as = –20 log10 ds
4. Determine the parameter a from the following equation for
ww B
0,
= 0.5842 (B s 21)0.4 + 0.07886 (B s + 21),
for B s < 21
for 21 < B s 50
w .Ea
0.1102(B s 8.7),
5. Determine the parameter D from the following Kaiser’s design equation
for B s > 50
syE 0.9222,
D = B 7.95
s
,
for B s 21
for B s > 21
14.36
ngi
6. Choose the filter order for the lowest odd value of N
N
B
nee
X sf D
+1
0,
I 0 B
, for | n |
otherwise
N 1
2 e t
8. Compute the modified impulse response using
h(n) = wk(n)hd(n)
9. The transfer function is given by
N 1
( N 1)/2
h(0) + 2 h( n) ( z + z )
2 n n
H ( z) = z
n 1
www.EasyEngineering.net
www.EasyEngineering.net
N 1
where a(0) = h
2
N 1
a( n) = 2 h n
2
ww
The design equations for the low-pass, high-pass, band-pass and band-stop filters are given
below:
w
Low-pass FIR filter
syE 2 fc
F , for n = 0
where fc =
1
2 ngi
(f p + f s ) and F = fs f p
rin
2 fc
1 F , for n = 0
g.n
where
Band-pass FIR filter
fc =
1
2
(f p + f s ) and F = f p fs
e t
1
nQ [ sin (2Q nfc 2 /F ) sin (2Q nfc1 /F )], for n > 0
hd (n) =
2 (f f ), for n = 0
F c 2 c1
where
F F
fc1 = f p1 fc 2 = f p 2 +
2 2
DF1 = fp1 – fs1 DFh = fs2 – fp2
DF = min [DFl, DFh]
www.EasyEngineering.net
www.EasyEngineering.net
1
nQ [ sin (2Q nfc1 /F ) sin (2Q nfc2 /F )], for n > 0
hd ( n) =
2 (f f ) + 1, for n = 0
F c1 c2
where
F F
fc1 = f p1 + fc 2 = f p 2
2 2
w .Ea
Summary of windows
The different windows parameters are compared in Table 9.3. Looking at the parameters for
syE
rectangular and triangular window, it can be noted that the triangular window has a transition
width twice that of rectangular window. However, the attenuation in stop band for triangular
window is less. Therefore, it is not very popular for FIR filter design. The Hanning and
ngi
Hamming windows have same transition width. But the Hamming window is most widely
used because it generates less ringing in the side lobes. The Blackman window reduces the
side lobe level at the cost of increase in transition width. The Kaiser window is superior to
nee
other windows because for given specifications its transition width is always small. By
varying the parameter a, the desired side lobe level and main lobe peak can be achieved.
Advantages g.n
1. The filter coefficients can be obtained with minimum computation effort.
2. The window functions are readily available in closed-form expression.
3. The ripples in both stop band and pass band are almost completely eliminated.
e t
Disadvantages
1. It is not always possible to obtain a closed form expression for the Fourier series
coefficients h(n).
2. Windows provide little flexibility in design.
3. It is somewhat difficult to determine, in advance, the type of window and duration
N required to meet a given prescribed frequency specification.
Table 9.3 shows the different window sequences.
www.EasyEngineering.net
www.EasyEngineering.net
1, ( N 1) n N 1
Rectangular window w R (n ) = 2 2
0, otherwise
1, 0 n N 1
w R (n ) =
0, otherwise
ww 1 2 n ,
wT (n) = N 1
( N 1)
2
n
( N 1)
2
w
Triangular window
.Ea
0 , otherwise
1 2 n ( N 1) / 2 ,
N 1
0 n N 1
(or) wT (n) =
(or) whn (n) =
0
N 1
rin
0 n N 1
, otherwise
g.n
Hamming window
0.54 + 0.46 cos
wH (n) =
0
2nQ
N 1
,
( N 1)
2
, otherwise
n
2 e
N 1
t
2 nQ
0.54 0.46 cos , 0 n N 1
(or) wH (n) = N 1
0
, otherwise
(Contd.)
www.EasyEngineering.net
www.EasyEngineering.net
TABLE 9.3 Window sequences (functions) for FIR filter design (Contd.)
2nQ 4nQ
0.42 0.5 cos + 0.08cos , 0 n N 1
(or) wB ( n) = N 1 N 1
ww 0
, otherwise
w
Kaiser .Ea
wk ( n) =
I 0 B 1 2n
2
N 1
, ( N 1) n ( N 1)
I 0 (B )
syE
2 2
0 , otherwise
ngi
2 2
I 0 B N 1 n N 1
2
(or) wk (n) =
nee
N 1
I0 B
2
, 0 n ( N 1)
2
0
2
rin
, otherwise
g.n
EXAMPLE 9.17
ap £ 0.1 dB, as ³ 38 dB
wp = 15 rad/sec, ws = 25 rad/sec, wsf = 80 rad/sec
e
Design an FIR low-pass filter satisfying the following specifications:
t
Solution: From the given specifications,
B= ws – wp = 25 – 15 = 10 rad/sec
1 1
Xc = (X p + X s ) = (15 + 25) = 20 rad/sec
2 2
2Q 20 2Q Q
X c (in radians) = X cT = X c = =
X sf 80 2
www.EasyEngineering.net
www.EasyEngineering.net
Step 1:
Q
1, for |X |
2
H (X ) =
0, Q
for | X | 2Q
2
Q /2
Q
sin n
1 jX n
hd ( n) =
2Q e dX =
nQ
2
Q /2
Step 2:
ww E s = 10 0.05(38) = 12.59 10 3
100.05(0.1) 1
w .Ea
Ep =
10 0.05(0.1)
+1
E = min (E s , E p ) = 5.7564 10 3
= 5.7564 10 3
Step 3:
syE Bs = 20 log10 E = 44.797 dB
Step 4: For
as = 44.797
a = 0.5842 (as ngi
– 21)0.4 + 0.07886 (as – 21) = 3.9524
nee
ÿ
Step 5: For
as = 44.797
D=
B s 7.95 = 2.566
rin
Step 6:
14.36
g.n
N
X sf D
B
80(2.566)
+1
+1
e t
10
21.52
Hence N = 23
Step 7: The window sequence
2
2n
I0 B 1
N 1 N 1
wk ( n) = for | n |
I 0 (B ) 2
www.EasyEngineering.net
www.EasyEngineering.net
We can find
2
1 B k 0.25(3.9524)2 (0.25 3.95242 )2 (0.25 3.95242 )3 .. .
I 0 (B ) = 1 + =1+ + + +
k 1 k ! 2 (1!)2 (2!)2 (3!)2
= 10.8468
ww wk (0) =
I 0 (B )
I 0 (B )
=1
w wk (1) = wk ( 1) =
.Ea
I 0 (3.9360)
10.8468
I 0 (3.8860)
=
10.23
10.8468
9.828
= 0.9431
wk (2) = wk ( 2) =
syE
wk (3) = wk ( 3) =
10.8468
I 0 (3.8025)
=
10.8468
9.1932
= 0.906
ngi
= = 0.8475
10.8468 10.8468
I 0 (3.6818) 8.3411
wk (4) = wk ( 4) =
nee
= = 0.7689
10.8468 10.8468
I 0 (3.5204) 7.3242
wk (5) = wk ( 5) = = = 0.6752
10.8468
I 0 (3.3126)
10.8468
6.1981 rin
wk (6) = wk ( 6) =
10.8468
=
10.8468
= 0.5714
g.n
e
I 0 (3.048) 5.018
wk (7) = wk ( 7) = = = 0.4626
wk (8) = wk ( 8) =
10.8468
I 0 (2.7127)
10.8468
=
10.8468
3.8971
10.8468
= 0.3592 t
I 0 (2.2724) 2.7672
wk (9) = wk ( 9) = = = 0.2551
10.8468 10.8468
I 0 (1.6465) 1.8011
wk (10) = wk ( 10) = = = 0.1660
10.8468 10.8468
I 0 (0) 1
wk (11) = wk ( 11) = = = 0.0922
10.8468 10.8468
www.EasyEngineering.net
www.EasyEngineering.net
ww
For n = 6, hd(6) = 0,
For n = 7, hd(7) = –0.0454, \ h(7) = hd(7) ´ wk(7) = –0.0454 ´ 0.4626 = – 0.0210
For n = 8, hd(8) = 0, \ h(8) = hd(8) ´ wk(8) = 0 ´ 0.3592 = 0
.Ea
For n = 10, hd(10) = 0,
For n = 11, hd(11) = – 0.0289,
\
\
\
h(9) = hd(9) ´ wk(9) = 0.03536 ´ 0.2551 = 0.00902
h(10) = hd(10) ´ wk(10) = 0 ´ 0.1660 = 0
h(11) = hd(11) ´ wk(11) = – 0.0289 ´ 0.0922 = – 0.00266
syE
The transfer function is given by
ngi
11
H ( z) = z 11 h(0) +
h( n) ( z n + z n )
n 1
nee
9.7 DESIGN OF FIR FILTERS BY FREQUENCY SAMPLING TECHNIQUE
rin
In this method, the ideal frequency response is sampled at sufficient number of points (i.e.
N-points). These samples are the DFT coefficients of the impulse response of the filter.
Hence the impulse response of the filter is determined by taking IDFT.
Let Hd(w) = Ideal (desired) frequency response g.n
H (k ) = The DFT sequence obtained by sampling Hd(w)
h(n) = Impulse response of FIR filter
The impulse response h(n) is obtained by taking IDFT of H (k ) . For practical
e t
realizability, the samples of impulse response should be real. This can happen if all the
complex terms appear in complex conjugate pairs. This suggests that the terms can be
matched by comparing the exponentials. The terms H ( k ) e j (2Q nk/N ) should be matched by the
j (2Q nk ) /N
term that has the exponential e as a factor.
Two design techniques are available, viz., type-I design and type-II design. In the
type-I design, the set of frequency samples includes the sample at frequency w = 0. In some
cases, it may be desirable to omit the sample at w = 0 and use some other set of samples.
Such a design procedure is referred to as the type-II design.
www.EasyEngineering.net
www.EasyEngineering.net
2Q nk
( N 1)/2
ww 1 j
When N is odd, h( n) = H (0) + 2 Re H ( k ) e N
N k 1
w .Ea
1
N
H (0) + 2
2 1
H ( k )
j
e N
2Q nk
syE
When N is even, h( n) =
N
k 1
where ‘Re’ stands for ‘real part of’.
ngi
4. Take Z-transform of the impulse response h(n) to get the transfer function H(z).
\ H ( z) =
N 1
nee
h ( n) z n
rin
n0
N
2 1
2
When N is even, h( n) =
N
Re H ( k ) e jnQ (2 k 1)/N
k 0
www.EasyEngineering.net
www.EasyEngineering.net
4. Take Z-transform of the impulse response h(n) to get the transfer function H(z).
N 1
\ H ( z) = h ( n) z n
n0
Important formulae
The following formulae can be used for calculation of h(n) while designing FIR filter by
frequency sampling method.
NR ( N 1)
R
ww 1.
N 1
k 0
cos kR =
sin
2
cos
sin
R
2
w 2.
N 1
.Ea
sin kR =
sin
NR
2
sin
2
( N 1)
2
R
R
k 0
syE sin
2
The procedure for FIR filter design by frequency sampling method is:
1.
2.
Choose the desired frequency response Hd(w).
ngi
Take N samples of Hd(w) to generate the sequence H (k ) .
3.
4. nee
Take inverse DFT of H (k ) to get the impulse response h(n).
The transfer function H(z) of the filter is obtained by taking Z-transform of the
impulse response h(n).
rin
g.n
EXAMPLE 9.18 Design a linear phase low-pass FIR filter with a cutoff frequency of
p/2 rad/sec using frequency sampling technique. Take N = 13.
Solution: The frequency response of desired linear phase low-pass filter with a cutoff
frequency wc = p/2 rad/sec can be written as:
e jBX , 0 |X | Q /2
H d (X ) =
e t
0 , otherwise
N 1 13 1
where B = = = 6 (for linear phase filter)
2 2
Let us choose type-I design, therefore,
2Q k 2Q k
Xk = =
N 13
The sequence H (k ) is obtained by sampling Hd(w) at 13 equidistant points in a period of 2p.
www.EasyEngineering.net
www.EasyEngineering.net
i.e., H ( k ) = H d (X ) X X 2Q k 2 Q k
k
N 13
2Q 0 2Q 1 2Q
When k = 0, wk = w0 = =0, When k = 1, wk = w 1 = =
13 13 13
2Q 2 4Q 2Q 3 6Q
When k = 2, wk = w2 = = , When k = 3, wk = w 3 = =
13 13 13 13
2Q 4 8Q 2Q 5 10Q
When k = 4, wk = w4 = = , When k = 5, wk = w 5 = =
13 13 13 13
2Q 6 12Q 2Q 7 14Q
wk = w6 wk = w 7
ww When k = 6,
wk = w8 =
=
13
=
13
2Q 8 16Q
, When k = 7,
wk = w 9 =
=
13
=
13
2Q 9 18Q
w When k = 8,
When k = 10,
.Eawk = w10 =
13
13
=
13
2Q 10
=
,
20Q
13
When k = 9,
, When k = 11, wk = w 11 =
13
=
13
2Q 11 22Q
13
=
13
When k = 12,
syE
wk = w12 = 2Q 12
13
=
24Q
13
ngi
From the above calculations, the following observations can be made:
3Q
X 2Q .
For k = 10 to 12, the samples lie in the range
rin
g.n
2
The sampling points on the ideal response are shown in Figure 9.9 and the magnitude
spectrum of H (k ) is shown in Figure 9.10.
e t
www.EasyEngineering.net
www.EasyEngineering.net
w .Ea j 6 2Q k
e
13 , for k = 0, 1, 2, 3
\
syE H ( k ) = 0
e
2Q k
j 6 13
,
,
for k = 4, 5, 6, 7, 8, 9
rin
N k 1
1 6
H (0) + 2 Re[ H ( k ) e
g.n
j 2Q nk 13
= ]
13 k 1
1 3 j 2 Q k (6 n )
=
13
1 + 2 Re e 13
k 1
1 3 2Q k
= 1 + 2 cos (6 n)
13
k 1 13
www.EasyEngineering.net
www.EasyEngineering.net
1 3 2Q k
= 1 + 2 cos (6 n) 1
13 k 0 13
1 3 2Q k
= 2 cos (6 n) 1
13 k 0 13
MR M 1
M 1 sin cos R
2 2
We know that, cos kR =
ww k 0 sin
R
2
w
Here, M – 1 = 3, and R =
.Ea
2Q
13
(6 n), M = 4
h( n) =
1
13
syE
2 sin 4 2Q (6 n) cos 3 2Q (6 n)
2 13 2 13
Q (6 n)
1
sin
13
ngi
4Q (6 n)
13
3Q (6 n)
4Q (6 n) 3Q (6 n) rin Q (6 n)
=
1
sin
13
+
13
+ sin
13
Q (6 n)
13
g.n
sin
13
e
13
sin
=
1
7Q (6 n)
sin
13
Q (6 n)
+ sin
13
13
sin
Q (6 n)
13
t
13 Q (6 n)
sin
13
7Q (6 n)
sin
1 13
\
Q (6 n)
h(n) = ; for n = 0, 1, 2, ... , 12 except when n = 6
13
sin
13
www.EasyEngineering.net
www.EasyEngineering.net
7Q (6 n) 7Q (6 n)
sin sin
1 13 1 13 7
h(6) = Lt = Lt = = 0.5384
n 6 13 Q (6 n) 13 n 6 Q (6 n) 13
sin sin
13 13
Substituting the values of n, we have
ww h(2) =
13 sin 4Q /13
1 sin 7Q 2/13
= 0.0434 ,
= 0.0396 ,
h(3) =
13 sin 3Q /13
1 sin 7Q /13
w h(4) =
h(6) =
13 sin 2Q /13
7
13 .Ea
= 0.538
h(5) =
13 sin 2Q /13
= 0.3190
a= syE
For linear phase FIR filters, the condition h(N – 1 – n) = h(n) will be satisfied when
(N – 1)/2. Therefore,
h(7) = h(13 – 1 – 7) = h(5) = 0.3190,
h(9) = h(13 – 1 – 9) = h(3) = –0.1084, ngi h(8) = h(13 – 1 – 8) = h(4) = –0.0396
h(10) = h(13 – 1 – 10) = h(2) = 0.0434
h(11) = h(13 – 1 – 11) = h(1) = 0.0677,
nee
h(12) = h(13 – 1 – 12) = h(0) = –0.0513
rin
The transfer function of the filter H(z) is given by the Z-transform of h(n). Therefore,
N 1 12
\ h( n) z n = h ( n) z n
g.n
H (z ) =
n0 n0
e
5 12
= h(n) z n + h(6) z 6 + h(n) z n
=
n0
5
h(n) z n + h(6) z 6 +
n0
n7
5
h(12 n) z (12n)
n0
t
5
= h(n) [ z n + z (12 n) ] + h(6) z 6
n0
www.EasyEngineering.net
www.EasyEngineering.net
EXAMPLE 9.19 Design a linear phase FIR filter of length N = 11 which has a symmetric
unit sample response and a frequency response that satisfies the conditions:
1 , for k = 0, 1, 2
2Q k
H = 0.5 , for k = 3
11
0 , for k = 4, 5
ww
Solution: For linear-phase FIR filter, the phase function, q (w) = –aw, where a = (N – 1)/2.
w Here N = 11,
Also, here
.Ea
X = Xk
N
\
2Q k
= =
a=
2Q k
11
.
(11 – 1)/2 = 5.
syE
Hence we can go for type-I design. In this problem, the samples of the magnitude
response of the ideal (desired) filter are directly given for various values of k. Therefore,
H ( k ) = H d (X ) X X k
ngi
1 e jBX k ,
jBX k
k = 0, 1, 2
0nee
= 0.5 e ,
,
k =3
k = 4, 5
where, Xk =
2Q k
rin
11
H (0) = e jBX0 = e
2Q 0
j5 g.n
e
When k = 0, 11
=1
2Q 2
j5
=e
10 Q
j
11
20 Q
j
t
When k = 2, H (2) = e jBX2 = e 11
=e 11
2Q 3 30 Q
j5 j
When k = 3, H (3) = e jBX3 = e 11
=e 11
When k = 4, H (4) = 0
When k = 5, H (5) = 0
www.EasyEngineering.net
www.EasyEngineering.net
(N 1)/2
1 j 2Q nk/N
h( n) = H (0) + 2 Re H (k ) e
N
k 1
1 5
=
11
H (0) + 2 Re H ( k ) e j 2Q nk/N
k 1
H (3) e j 2Q n3/11
2
1
H (0) + 2 Re H (k ) e
j 2Q nk/11
= + 2 Re
ww 1
11
2
k 1
j 5 2Q k 2 Q nk
j 5 2 Q 3
2Q n 3
w
j j
1 + 2 Re e + 2 Re 0.5 e 11
= 11
e 11 11
11
1
.Ea
k 1
j 2Q k (n 5)
6Q
( n 5)
syE
2
1 + 2 Re e 11
j
= + 2 Re 0.5 e 11
11
k 1
=
1
+
2
11 11
cos
2Q
11
(n 5) +
2
11
cos
4Q
11
( n 5) + cos
ngi
6Q
11
( n 5)
n = 0, h(0) =
1
+
2
11 11
10Q
cos +
11 11
2 20Q
cos
11 nee 30Q
+ cos
11
= 0.5854
n = 1, h(1) =
1
+
2 8Q
cos +
11 11
2 16Q
cos
11
24Q
+ cos
11
= 0.787 rin
g.n
11 11
1 2 6Q 2 12Q 18Q
n = 2, h(2) = + cos + cos + cos = 0.3059
n = 3, h(3) =
11 11
1
+
11 11
2
11 11
4Q
cos
11
+
2
11
11
8Q
cos
11
11
12Q
+ cos
11
= 0.9120
e t
1 2 2Q 2 4Q 6Q
n = 4, h(4) = + cos + cos + cos = 0.1770
11 11 11 11 11 11
1 2 2 5
n = 5, h(5) = + cos 0 + cos 0 + cos 0 = + 1 = 1.4545
11 11 11 11
For linear-phase FIR filters, the condition h(N – 1 – n) = h(n) will be satisfied when
a = (N – 1)/2.
When n = 6, h(6) = h(11 – 1 – 6) = h(4) = 0.1770
When n = 7, h(7) = h(11 – 1 – 7) = h(3) = –0.9120
www.EasyEngineering.net
www.EasyEngineering.net
4 10
= h(n) z n + h(5) z 5 + h ( n) z n
ww n0
h(n) z n + h(5) z 5 +
n6
=
n0
4
.Ea
n0
syE
= h(0) 1 + z 10 + h(1) z 1 + z 9 + h(2) z 2 + z 8 + h(3) z 3 + z 7
+ h(4) z 4 + z 6 + h (5) z 5
ngi
nee
= 0.5854 1 + z 10 + 0.787 z 1 + z 9 + 0.3059 z 2 + z 8 0.9120 z 3 + z 7
+ 0.1770 z 4 + z 6 + 1.4545 z 5
rin
SHORT QUESTIONS WITH ANSWERS
g.n
1. What are the different types of filters based on impulse response?
Ans. Based on impulse response, filters are of two types:
(i) IIR filters and (ii) FIR filters
e t
The IIR filters are designed using infinite number of samples of impulse response.
They are of recursive type, whereby the present output depends on the present
input, past input and past output samples.
The FIR filters are designed using only a finite number of samples of impulse
response. They are non-recursive type whereby the present output depends on the
present input and past input samples.
2. What are the different types of filters based on frequency response?
Ans. Based on frequency response, filters are of four types:
(i) Low-pass filter, (ii) High-pass filter, (iii) Band-pass filter, and (iv) Band-stop filter.
www.EasyEngineering.net