Fir Filter

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

UNIT-IV

FIR DIGITAL FILTERS

INTRODUCTION
A filter is a frequency selective system. Digital filters are classified as finite duration unit
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.
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 (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 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.
Advantages of FIR filter over IIR filters:
1. FIR filters are always stable.
2. FIR filters with exactly linear phase can easily be designed.
3. FIR filters can be realized in both recursive and non-recursive structures.
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.
Disadvantages of FIR filters:
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.

FIR filters are employed in filtering problems where linear phase characteristics within the
pass band of the filter are 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.

Characteristics o f Fir Filters w i t h Linear Phase


The transfer function of a FIR causal filter is given by

N 1

H(z) =  h(n) zn


n0

where h(n) is the impulse response of the filter. The frequency response [Fourier transform of
h(n)] is given by
N 1

H( ω ) =  h(n) e j n
n0
which is periodic in frequency with period 2 , i.e.,
H( ω ) = H( ω + 2k ), k = 0, 1, 2, ...
Since H(ω ) is complex it can be expressed as

where H(ω ) is the magnitude response and (ω) is the phase response

We define the phase delay τ p and group delay τg of a filter as:

For FIR filters with linear phase, we can define

Where α is constant phase delay in samples

d
i.e. τp = τg =α which means that α is independent of
frequency.

We have
N 1

 h(n) e j n =  H(ω) e j θ(ω )


n0
i.e.

N 1

 h(n)[cosω n  j sinωn] =  |𝐻(ω) | [cosθ (ω ) + j sinθ (ω )]


This gives us
N 1

 h(n) cosω n =  |𝐻(ω) | cosθ (ω )


n0

N 1

 h(n) sin ω n =  |𝐻(ω) | sin θ (ω )


n0
Therefore,

i.e.
N 1

 h(n) [sin ωn cos αω - cosωn sin αω] = 0


n0
i.e.
N 1

 h(n) sin (α  n)ω = 0


n0
This will be zero when

This shows that FIR filters will have constant phase and group delays when the impulse
response is symmetrical about α= (N – 1)/2.
The impulse response satisfying the symmetry condition h(n) = h(N – 1 – n) for odd and even
values of N is shown in Figure 1. When N = 9, the centre of symmetry
of the sequence occurs at the fourth sample and when N = 8, the filter delay is2 3 1 samples.

(a) (b)
Figure 1 Impulse response sequence of symmetrical sequences for (a) N odd (b) N even.

If only constant group delay is required and not the phase delay, we can write
θ(ω ) = β – αω
Now, we have

This gives
Cross multiplying and rearranging, we get

If β = π/2, the above equation can be written as:

This equation will be satisfied when

This shows that FIR filters have constant group delay τ g and not constant phase delay when
the impulse response is antisymmetrical about α= (N – 1)/2.
The impulse response satisfying
32 the antisymmetry condition is shown in Figure 2. When
N = 9, the centre of antisymmetry occurs at fourth sample and when N = 8, the centre of

antisymmetry occurs at samples. From Figure 2, we find that h[(N – 1)/2] = 0 for
antisymmetric odd sequence.





 a b
Figure 2 Impulse response sequence of antisymmetric sequences for (a) N odd (b) N even.

EXAMPLE 1 The length of an FIR filter is 7. If this filter has a linear phase, show that

is satisfied
Solution: The length of the filter is 7. Therefore, for linear phase,

The condition for symmetry when N is odd, is h(n) = h(N – 1 – n).


Therefore, the filter coefficients are h(0) = h(6), h(1) = h(5), h(2) = h(4) and h(3).


Hence, the equation is satisfied.

EXAMPLE 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.

Solution: The transfer function of the filter is given by

The phase delay

Since h(n) = h(N – 1 – n)

The frequency response is obtained by replacing z with e j .


Thus, the phase delay and the group delay are the same and are constants.

Design Techniques for FIR FIilters


The well known methods of designing FIR filters are as follows:
1. Fourier series method
2. Window method
3. Frequency sampling method
4. Optimum filter design
In Fourier series method, the desired frequency response Hd (ω ) is converted to a
Fourier series representation by replacing by 2 π fT, where T is the sampling time. Then
using this expression, the Fourier coefficients are evaluated by taking inverse Fourier
transform of Hd (ω ), 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
infinite duration. A finite duration impulse response h(n) can be obtained by truncating the
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.
In window method, we begin with the desired frequency response specification Hd(ω )
and determine the corresponding unit sample response hd(n). The hd(n) is given by the
inverse Fourier transform of Hd(ω ). The unit sample response hd(n) will be an infinite
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
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.
In frequency sampling method of filter design, we begin with the desired frequency
response specification Hd(ω), 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
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.
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( ω).
2. Take inverse Fourier transform of Hd (ω ) to get hd (n) or sample Hd (ω ) 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).
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.

Design OF FIR Filters using Windows


The procedure for designing FIR filter using windows is:
1. Choose the desired frequency response of the filter Hd(ω).
2. Take inverse Fourier transform of Hd(ω ) 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
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).

Rectangular Window
The weighting function (window function) for an N-point rectangular window is given by

The spectrum (frequency response) of rectangular window WR(ω) is given by


the Fourier transform of wR(n).
The frequency spectrum for N = 31 is shown in Figure 3. The spectrum WR(ω ) has two
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 ω = 2k /N where k is an integer.
The response for between –2π /N and 2π /N is called the main lobe and the other lobes are
called side lobes. For rectangular window the width of main lobe is 4π /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 the
window is made longer, the main lobe becomes narrower and higher, and the side lobes become
more concentrated around ω= 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.
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
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.
Figure 3 (a) Rectangular window sequence, (b) Magnitude response of rectangular window,
(c) Magnitude response of Now-pass filter approximated using rectangular window.

Triangular or Bartlett Kindow


The triangular window has been chosen such that it has tapered sequences from the middle
on either side. The window function wT (n) is defined as

 

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 8 /N or twice that of the rectangular window.
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.
Because of these characteristics, the triangular window is not usually a good choice

Raised Cosine Window

The raised cosine window multiplies the central Fourier coefficients by approximately unity
and smoothly truncates the Fourier coefficients toward the ends of the filter. The smoother
ends and broader middle section produces less distortion of hd(n) around n = 0. It is also
called generalized Hamming window.
The window sequence is of the form:

Hanning W i ndow
The Hanning window function is given by

The width of main lobe is 8 /N, i.e., twice that of rectangular window which results in
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
attenuation of the filter is 44 dB. At higher frequencies the stop band attenuation is even
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
window.
Hamming Window
The Hamming window function is given by

In the magnitude response for N = 31, the magnitude of the first side lobe is down about 41dB
from the main lobe peak, an improvement of 10 dB relative to the Hanning window. But this
improvement is achieved at the expense of the side lobe magnitudes at higher frequencies,
which are almost constant with frequency. The width of the main lobe is 8 /N. In the magnitude
response of low-pass filter designed using Hamming window, the first side lobe peak is –51 dB,
which is –7 dB lesser with respect to the Hanning window filter. However, at higher
frequencies, the stop band attenuation is low when compared to that of Hanning window.
Because the Hamming window generates lesser oscillations in the side lobes than the Hanning
window for the same main lobe width, the Hamming window is generally preferred.
Blackman Window
The Blackman window function is another type of cosine window and given by the equation

In the magnitude response, the width of the main lobe is 12π /N, which is highest among
windows. The peak of the first side lobe is at –58 dB and the side lobe magnitude decreases 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 lobe
attenuation of a low-pass filter using Blackman window is –78 dB.
Table 1 gives the important frequency domain characteristics of some window functions.

TABLE 1 Frequency domain characteristics of some window functions.

Type of Approximate Minimum stop Peak of first


window transition band attenuation side lobe
width of main lobe (dB) (dB)
Rectangular 4π /N –21 –13
Bartlett 8π /N –25 –25
Hanning 8π /N – 44 –31
Hamming 8 π /N –51 – 41
Blackmann 12π /N –78 –58

EXAMPLE 3
Design an ideal low-pass filter with N = 11 with a frequency response

Solution: For the given desired frequency response,


 

The filter coefficients are given by


Assuming the window function,

We have

Therefore, the designed filter coefficients are given as

The above coefficients correspond to a non-causal filter which is not realizable.


The realizable digital filter transfer function H(z) is given by
Therefore, the coefficients of the realizable digital filter are:

























You might also like