ECET 350-Lab 3 - Digital Filter Design
ECET 350-Lab 3 - Digital Filter Design
Name(s): Professor:
Dr. Omar
Team or Group #(if applicable):
Experiment or Assignment #: Lab03 Lab Meeting Day & Time:
Title of Report:
Lab#3
Objectives:
Introduction
A digital filter is described in Figure 1, where x (n) and y (n) are the DSP filter input and
filter output, respectively
−1 −M
Y ( z ) b o+ b1 z + …+b M z
H ( z )= = .
X ( z ) 1+ a1 z−1 +…+ a N z −N
The filter defined above is called the IIR (Infinite Impulse Response) filter. When the
denominator becomes to be 1, the filter is called an FIR (Finite Impulse Response) filter,
that is
Y ( z)
H ( z )= =b o +b1 z−1 +…+b M z−M
X (z )
ECET350/Lab03 2
The filter coefficients could be obtained via the filter design to meet its frequency-domain
specifications. Given the filter transfer function, its frequency response can be calculated
and plotted for verification. As an example, the frequency responses of a bandpass filter
operating at the sampling rate of 8000 Hz is given in Figure 2.
Figure 3 shows the original speech and filtered speech in time-domain while Figure 4
displays the spectrum for the original speech and the filtered speech, respectively.
As shown in Figure 4, the bandpass filter significantly reduces both low frequency
components and the high frequency components, meanwhile letting the signal components
with the frequencies in the mid range pass through the filter.
In this experiment, we will examine the difference equation, transfer function, and the
operation of the digital filter. Further we examine the frequency responses of the designed
digital filters. Finally, we process various digital signals using digital filters.
ECET350/Lab03 3
Figure 3. Graphs of the original speech and filtered speech
Figure 4. Amplitude spectra of the original speech and bandpass filtered speech
ECET350/Lab03 4
1. FIR Filters
c. Given sampled values: sample=[1:1:10], write a MATLAB program to perform the digital
filtering:
sample =[1:1:10];
x=[0 0 sample];
for n=3:1:length(x)
y(n)= complete on your own;
end
y(3:1:length(x))
FIR system 1:
bLP =[
-0.0012 -0.0025 -0.0045 -0.0068 -0.0073 -0.0030 0.0089 …
0.0297 0.0583 0.0907 0.1208 0.1422 0.1500 0.1422 …
0.1208 0.0907 0.0583 0.0297 0.0089 -0.0030 -0.0073 …
-0.0068 -0.0045 -0.0025 -0.0012 ];
FIR system 2:
bBP =[
0.0004 -0.0017 -0.0064 -0.0076 0.0073 0.0363 0.0458 …
0.0000 -0.0802 -0.1134 -0.0419 0.0860 0.1500 0.0860 …
-0.0419 -0.1134 -0.0802 0.0000 0.0458 0.0363 0.0073 …
-0.0076 -0.0064 -0.0017 0.0004 ];
i. Determine the transfer function using z-transform for the first FIR system.
ii. Determine the difference equation for the first FIR system.
ECET350/Lab03 5
Plot the frequency responses using the MATLAB function freqz() for each of z-transfer
functions.
x (t )=5 cos ( 1000 πt )+ 5 cos ( 2400 πt +0.25 π ) +5 cos (3600 πt +0.5 π) using a sampling rate of
8 kHz.
iv. Write the commands using the MATLAB function filter() according to the two given
FIR systems. Example: for the above lowpass filter you can find the filtered signal y (output)
using:
y=filter(bLP,1,x);
¿ Perform digital filtering using each of the developed programs; plot the input signal
spectrum and the output signal spectrum, respectively. Print and label the spectrum.
¿
Xf =|(fft ( x ) )|
¿ Listen to and compare the input signal and output signal from each filter, respectively.
Discuss the obtained results.
Hint: MATLAB>>sound(x/max(abs(x)),8000);
ECET350/Lab03 6