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

ABES ENGINEERING COLLEGE, GHAZIABAD

DEPARTMENT OF ELECTRONICS &


COMMUNICATION ENGINEERING

COURSE MATERIAL
Subject Name:
Name:DIGITAL
DIGITAL SIGNAL PROCESSING
Subject Code: KEC -503
Branch/Semester: ECE / 5th
Session: 2022
2022-23(Odd-Semester)

Faculty Members
Dr. Devvrat Tyagi
Dr. Mangal Deep Gupta
KEC503
DIGITAL SIGNAL PROCESSING

Contents as per syllabus:

UNIT-3 Syllabus

3. Finite Impulse Response Filter (FIR) Design:


3.1. Introduction to FIR FilterDesign
3.2. Need of FIR Filter Design
3.3. Windowing and the Rectangular Window
3.3.1. Procedure of FIR filter design using windowing
3.3.2. Rectangular Window
3.4. Gibb’s phenomenon
3.5. Other Commonly Used Windows
3.5.1. Triangular or Bartlett window
3.5.2. Hamming Window
3.5.3. Hanning Window
3.5.4. Blackmann Window
3.5.5. Kaiser Window
3.6. Examples of Filter Designs Using Windows.
3.7. Finite Word length effects
3.7.1. Coefficient quantization error
3.7.2. Quantization noise – truncation and rounding,
3.7.3. Limit cycle oscillations-dead band effects
3.8. Advantages and Disadvantages of FIR Filter Design
3.9. Industrial exposure of FIR Filter
3. Finite Impulse Response Filter (FIR) Design
3.1. Introduction to FIR Filter

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
(feed-backpoles 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. The well-known methods of designing FIR filters are
Fourier series method, Window method, Frequency sampling method, Optimum
filter design.

3.2. Need of FIR Filter


An FIR filter is a filter with no feedback in its equation. This can be an advantage
because it makes an FIR filter inherently stable. Another advantage of FIR filters is
the fact that they can produce linear phases. So, if an application requires linear
phases, an FIR filter must be used.

3.3.Windowing and Rectangular Window


In window method, we begin with the desired frequency response specification H(ω
) and determine the corresponding impulse response h(n). The h(n) is given by the
inverse Fourier transform of H(ω ). The unit sample response 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 tran
transfer
sfer function H(z). There have been many
windows proposed like Rectangular window, Triangular window, Hanning window,
Hamming window, Blackman window and Kaiser Window that approximate the
desired characteristics.
3.3.1.
.3.1. Procedure of FIR filter design using windowing

The procedure for designing FIR filter using windows is summarised as:
as
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
ndow 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
Z-transform of h(n).

3.3.2. Rectangular window


The (zero-centred) rectangular window can be defined by

where is the window length in samples.A


.A plot of the rectangular window appears
in Fig.3.1 for length . It is sometimes convenient to define windows so that
their dc gain is 1, in which case we would multiply the definition above by 1/M
Figure 3.1: The rectangular window.
To see what happens in the frequency domain,, we need to look at the DTFT of the
window:

Figure 3.2: Fourier transform of the rectangular window.


Figure 3.2 illustrates the spectrum of the window function for M=11. Note that this
is the complete window transform, not just its real part. We obtain real window
transforms like this only for zero
zero-centred, symmetric windows.
The phase of rectangular
rectangular-window transform is zero for Ꞷ<2π/M
<2π/M , which is the
width of the main lobe.. This is why zero
zero-centred windows are often called zero-
phase windows; while the phase actually alternates between 0 and radians, the
values occur only within side-lobes which are routinely neglected (in fact, the
window is normally designed to ensure that all side
side-lobes
lobes can be neglected).
Plot of the window transform magnitud
magnitude on a decibel (dB)) scale,
scale as shown in
Fig.3.3 below. It is common to normalize the peak of the dB magnitude to 0 dB, as
we have done here.

Figure 3.3: Magnitude (dB) of the rectangular


rectangular-window
window transform.

3.4.. Gibb’s phenomenon


If we design a low-pass
pass filter using rrectangular window, 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
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, shown in Figure 3.4 .

Figure 3.4: Illustration of Gibbs phenomena.

Rectangular window has an abrupt transition to zero outside the range -M ≤ n ≤ M,


which results in Gibbs phenomenon.
Gibbs phenomenon can be reduced by following ways:
1. Providing a smooth transition from passband to stopband in the magnitude
specifications.
2. Using a window that tapers smoothly to zero at each end like Blackman,
Hamming ,Hanning , Keiser windows etc.
3.5. Other Commonly Used Windows
3.5.1. Triangular or Bartlett window: The triangular window has been chosen
such that it has tapered sequences from the middle on either side. The window
function wr (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

3.5.2. 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.
3.5.3. Hanning Window: 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

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

3.5.5. Kaiser window:It is also known as the Kaiser–Bessel window, was


developed by James Kaiser at Bell Laboratories. It is a one-parameter family
of window functions used in finite impulse response filter design and spectral
analysis. The Kaiser window approximates the DPSS window which maximizes
the energy concentration in the main lobebut which is difficult to compute.

The Kaiser window is nearly optimal in the sense of its peak's concentration around
frequency.

3.6. Filter Designs Using Windows

Example1:Design a LPF using rectangular window for the desired frequency


response of a low pass filter given by ωc = π/ 2 rad/sec, and take M=11. Find the
values of h(n). Also plot the magnitude response.
Figure. 3.5. Magnitude response of the designed filter

Example:2The desired frequency response of low pass filter is given by

Determine the frequency response of the FIR if Hamming window is used with
N=7
The given window is Hamming window:
To calculate the value of h(n): h(n) = hd (n)w(n)

The frequency response is symmetric with M=odd=7

Figure. 3.6. Magnitude response of the designed LPF

3.7. Finite Word length effects in digital filters

The filter coefficients are determined by the system transfer functions. These
filter co-efficient are quantized/truncated while implementing DSP System
because of finite length registers. Only Finite numbers of bits are used to perform
arithmetic operations. Typical word length is 16 bits, 24 bits, 32 bits etc. This
finite word length introduces an error which can affect the performance of the
DSP system.
The main errors are:
1. Co-efficient quantization error
2. Quantization noise – truncation and rounding
3. Overflow & round off error (Limit cycle oscillations)

3.7.1. Coefficient Quantization Error


Each filter structure has its own finite, generally non-uniform grids of realizable
pole and zero locations when the filter coefficients are quantized to a finite word
length. In general the pole and zero locations desired in filter do not correspond
exactly to the realizable locations. The error in filter performance (usually
measured in terms of a frequency response error) resulting from the placement of
the poles and zeroes at the non-ideal but realizable locations is referred to as
coefficient quantization error.
Consider the second-order filter with complex-conjugate poles:

Figure 3.7 shows that quantizing the difference equation coefficients results in a
non-uniform grid of realizable pole locations in the z plane. The grid is defined
by the intersection of vertical lines corresponding to quantization of 2λr and
concentric circles corresponding to quantization of −r2.
Figure 3.7.Realizable pole locations for the difference equation.

The sparseness of realizable pole locations near z = ±1 will result in a large


coefficient quantization error for poles in this region.

3.7.2. Quantization noise- truncation and rounding


The designing of a digital filter means figuring out its coefficients. We store the
values of these coefficients in binary registers. These registers are just digital
memories in the DSP system.
Generally, we use infinite precision arithmetic for describing filter coefficients in
the interest of accuracy. But practically, it is not possible to store a large chain of
bits in a register. Thus we need to find a way to pack these filter coefficients into
a fixed word size register.
So, we ditch infinite precision arithmetic and go with the fixed-point
representation of binary numbers. In the fixed-point representation, the number of
digits before and after the decimal point is fixed. In this representation, the MSB
is said to represent the sign of the number.
Within fixed-point representation, we have three different ways of representing
numbers. This is just for your information. The three different formats are:
Sign magnitude: The leading binary digit represents the sign. (If MSB = 1,
number negative. If MSB = 0, number positive).

1s complement: All the bits are complemented.


2s complement: ‘1’ is added to 1s complement.
Now that we have a fixed number of bits, we need to make sure that these bits
match the word-size of the register memory we use to store the coefficient values.
If the number of bits is more, we quantize them.
Thus, quantization is the process of reducing the number of bits to ensure the
storage of the filter coefficients in the Digital Signal Processing system’s register.
There are two types of Quantization methods:
a. Truncation
b. Rounding

Truncation is a type of quantization where extra bits get ‘truncated.’Basically, in


the truncation process, all bits less significant than the desired LSB (Least
Significant Bit) are discarded.For example, suppose we wish to truncate the
following 8-bit number to 4-bits.
X = 0.01101011 truncates to X = 0.0110
Converting the above to decimal we can see that there is a large change in value.
(0.01101011 equals 0.418 and 0.0110 equals 0.375).
Thus, truncation is an inferior method of quantization since it has a high margin
for error.
The error from quantization using truncation is given by the formula:

Figure 3.8. Truncation


Rounding is a quantization method where we ’round-up’ a particular number to
the desired number of bits.Basically, rounding is the process of reducing the size
of a binary number to some desirable finite size. This is done in such a way that
the rounded off number is as close to the original un-quantized number as
possible.
Interestingly, the rounding process is a combination of truncation and addition.
In rounding a number to say b-bits, first, the number is truncated to the desired
number of bits. Then depending on the number that existed next to the LSB
before truncation, an addition to the LSB is performed.If that particular number
(previously next to the LSB) was 0, then 0 is added to the LSB. If that number
was 1, then a 1 is added to the LSB.
Consider the same example as above, suppose we wish to truncate the following
8-bit number to 4-bits.
 X = 0.01101011 truncates to X = 0.0110
 Since the number next to the current LSB was 1, we add 1 to the current
LSB.
 Thus X is now 0.0111
 Converting both the un-quantized and rounded off numbers to decimal, we
notice that the magnitude of error is less relative to truncation. (0.01101011
equals 0.418 and 0.0111 equals 0.438).
Thus rounding is preferable than truncation.The magnitude of error in rounding is
given by the formula:

Figure 3.9.Rounding
3.7.3. Limit cycle oscillations-dead band effects
In recursive system, the product quantization may create periodic oscillations in
the output. Limit cycles require recursion to exist, and do not occur in non-
recursive FIR filters.
These oscillations are called limit cycles. If the system output enters a limit
cycles, it will continue to remain in limit cycles even when the input is made
zero. Hence these limit cycles are also called zero input limit cycles.
The system output can be brought out of limit cycle by applying an input of
large magnitude, which is sufficient to drive the system out of limit cycle.

Dead band: In a limit cycle the amplitudes of the output are confined to a range
of values, which is called dead band of the filter.

3.8. Advantages and disadvantages of FIR filter


The FIR filter has following advantages:
a) FIR filters are always stable.
b) FIR filters with exactly linear phase can easily be designed.
c) FIR filters can be realized in both recursive and non-recursive structures.
The FIR filter has following disadvantages:
a) 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.
b) Memory requirement and execution time are very high.

3.9. Industrial exposure of FIR Filter


FIR filters are often used in Digital Communications in the IF stages of the
receiver.For example, a digital radio receives and down converts the analog signal
to the IF frequency and then converts it to digital with a D/A. Then uses the FIR
filter to select the desired frequency. This is used in software radio.
It allows easily adjustable filters, with good rejection, without changing hardware.
University Questions Related to Unit-3
Two Marks/short answer Questions

Q1. Compare FIR and IIR filter? [AKTU 2018-19]

Q.2. What are the advantages of Kaiser window? [AKTU 2018-19]

Q.3. What is window and why it is necessary?[AKTU 2018-19]

Q-4.What are advantages & disadvantages of window methods?


[AKTU 2019-20]

Q.5. Write the expression for Blackman and Bartlett window.[AKTU 2019-20]

Q.6.What is Gibb’s phenomenon in FIR filters?[AKTU 2020-21]

Q7. What is the dead band effect in digital filters?[AKTU 2020-21]

Q8. Define the recursive and non-recursive system.[AKTU 2020-21]

Seven Marks Questions

Q9. A FIR filter has following symmetry in impulse response: h(n)= h(M-1-n) for
M Even. Derive its frequency response and show that it has linear phase.
[AKTU 2019-20]

Q10. Design a low pas discrete time filter with following specification:

Use Kaiser Window for design.[AKTU 2019-20]

Q-11.Explain the Gibbs phenomenon. Find the response of rectangular window


and explain it.[AKTU 2019-20]

Ten Marks Questions

Q12. Design a linear phase low pass digital filter if the desired frequency
response is giving by
Using the bartlett window and choosing a suitable length of filter length M, find
the impulse response and frequency response of designed filter. Determine the
system function and difference equation. Also draw thelinear phase structure of
designed filter.[AKTU 2020-21]

Q13. Design a low pass digital filter using Kaiser window satisfying the
specifications given below:[AKTU 2020-21]

Passband cutoff frequency Fp=150 Hz


Stopband cutoff frequency Fs=250 Hz
Sampling frequency Ft=1000 Hz
Passband attenuation Ap=0.1 dB
Stopband attenuation As=40 dB

Q14. Explain the following terms with respect of finite word length effect in
digital filters:[AKTU 2021-22]
(i) Coefficient quantization error,
(ii) Quantization noise – truncation and rounding

Q15. Describe the linear phase FIR sysyem, and for h(n)=[1/2, 1/3, 1/5, 1/3, 1/2]
realize H(z) of linear phase FIR system.[AKTU 2021-22]

Additional Questions Related to Unit-3


Concept based questions & answers

Q1.What is the condition satisfied by linear phase FIR filter?


Answer: The condition for constant phase delay are
Phase delay, α = (N-1)/2 (i.e., phase delay is constant); &Impulse response, h(n)
= h(N-1-n) (i.e., impulse response is symmetric)

Q2.What are the properties of FIR filters?


Answer:a) FIR Filter is always stable.
b)A Realizable filter can always be obtained.

Q3.What is known as Gibbs phenomenon?


Answer: In the filter design by Fourier series method the infinite duration
impulse response is truncated to finite duration impulse response at n= (N-1/2).
The abrupt truncation of impulse introduces oscillations in the pass band and stop
band. This effect is known as Gibb’s phenomenon.
Q4.What is the reason that FIR filter is always stable?
Answer:FIR filter is always stable because all its poles are at the origin.
Q5. Compare the rectangular window and hanning window.
Answer:

Questions asked in competitive examinations with answers

Q1. What is the width of the main lobe of the frequency response of a
rectangular window of length M-1? [GATE 2003]
a) π/M
b) 2π/M
c) 4π/M
d) 8π/M

Answer:c
(Explanation: The width of the main lobe is measured to the first zero of W(ω)) is
4π/M.)
Q2. An FIR system is described as:

H(Z)=1+7/2 z-1 +3/2 z-2

The System is :[GATE-2008]


(a)maximum Phase
(b)minimum phase
(c)mixed phase
(d)zero phase

Answer: (c): one zero is inside and one is outside of unit circle

Electronics and Electrical Industry based questions & answers

Q1. Mention some design methods available to design FIR filter.


Answer:There are three well known method of design technique for linear phase
FIR filter. They are
a) window method
b) Frequency sampling method
c) Optimal filter design methods.
Q2.What are the disadvantages of FIR Filters (compared to IIR filters)?
Answer:Compared to IIR filters, FIR filters sometimes have the disadvantage
that they require more memory and/or calculation to achieve a given filter
response characteristic. Also, certain responses are not practical to implement
with FIR filters.
Q3. Why is the impulse response “finite?”

Answer:In the common case, the impulse response is finite because there is no
feedback in the FIR. A lack of feedback guarantees that the impulse response
will be finite. Therefore, the term “finite impulse response” is nearly synonymous
with “no feedback”.
However, if feedback is employed yet the impulse response is finite, the filter still
is a FIR. An example is the moving average filter, in which the Nth prior sample
is subtracted (fed back) each time a new sample comes in. This filter has a finite
impulse response even though it uses feedback: after N samples of an impulse,
the output will always be zero.

You might also like