You are on page 1of 9

Department of Electronics and Communication Engineering

National Institute of Technology, Tiruchirappali – 620 015

ECLR15 Digital Signal Processing Laboratory


V-Semester -UG

Dr. M. Bhaskar, Professor, ECE, NIT, Trichy-15 1


First Cycle
MATLAB based experiments

Experiment No. 3: FIR Filter Implementation

Dr. M. Bhaskar, Professor, ECE, NIT, Trichy-15 2


Objective/Aim of the experiment
1. Generation of signal X[n] with two amplitudes a1, a2
with two frequencies f1, f2 respectively.
2. Generation of noise signal N[n] with amplitude a3 with
frequency f3
3. Adding noise signal to X[n].
4. Finding the FIR filter coefficients h[n] for FIR filter using
window functions – rectangular, Hanning, Hamming,
Blackmann and Bartlett windows.
5. To filter the signal containing noise using convolution.
6. To study the effect of no. of filter coefficients to its
performance.

DR. M. BHASKAR, PROFESSOR, ECE, NIT, TRICHY-15 3


Theory
A filter removes unwanted frequency/frequencies from a signal

• A finite impulse response (FIR) filter is a filter whose impulse response (or
response to any finite length input) is of finite duration, because it settles to zero in
finite time.
• FIR filters can be discrete-time or continuous-time, and digital or analog.
• The impulse response of an Nth-order discrete-time FIR filter lasts exactly N + 1
samples (from first nonzero element through last nonzero element) before it then
settles to zero.
• Properties
 Requires no feedback
 Stable
 Designed to be linear phase

Dr. M. Bhaskar, Professor, ECE, NIT, Trichy-15 4


Theory cont.…
•An FIR causal function can be represented by transfer function

•Where h[n] is the impulse response of the FIR filter.


• The output of the filter y [n] = x[n] * h[n]

• FIR Filter design can be done using


 Window design method
 Frequency sampling method
 Weighted least square method
DR. M. BHASKAR, PROFESSOR, ECE, NIT, TRICHY-15 5
Types of window functions used for filter design
1)Hanning window

2)Hamming window

3)Blackmann window

DR. M. BHASKAR, PROFESSOR, ECE, NIT, TRICHY-15 6


Types of window functions used for filter design cont.…
4)Rectangular window

5)Bartlett window

DR. M. BHASKAR, PROFESSOR, ECE, NIT, TRICHY-15 7


Laboratory Work
1. Generate signal x[n] having two sine wave amplitudes a1, a2 with two frequencies
f1, f2 respectively.
2. Generate noise signal N[n] with amplitude a3 with frequency f3
3. Add noise signal to original signal to form a new signal S[n]
4. Generate the frequency response of the low-pass filter that has the magnitude
response given by the following equation.

5. Generate the window function w[n] for hamming window


6. Generate impulse response function of the FIR filter h[n] = hd[n] . W[n]
Obtain the filtered output y[n] by convolving S[n] and h[n]. Y[n] = S[n] * h[n].
7. Repeat the steps for all the window functions.

Dr. M. Bhaskar, Professor, ECE, NIT, Trichy-15 8


Required Input and output plots
1. Plot the noisy and noiseless signals X[n] and S[n]

2. Plot the magnitude response of the signals X[n] and S[n] in frequency domain

3. Plot the time domain sequence of window function w[n] for Rectangular, Hanning,
Hamming, Blackmann and Bartlett windows

4. Plot the magnitude and phase response of window functions in frequency domain

5. Plot the transition width and peak side lobes (dB) of each window

6. Plot the time domain output of the designed FIR filter for all windows

7. Plot the magnitude and phase response of the designed FIR filter in frequency
domain

8) Plot the filtered output Z[n]

9) Plot the magnitude response of filtered output Z[n] in frequency domain


DR. M. BHASKAR, PROFESSOR, ECE, NIT, TRICHY-15 9

You might also like