0% found this document useful (0 votes)
34 views6 pages

ECET 350-Lab 3 - Digital Filter Design

Uploaded by

Newaz Robi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views6 pages

ECET 350-Lab 3 - Digital Filter Design

Uploaded by

Newaz Robi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

DeVry University –– ECET-350

Name(s): Professor:
Dr. Omar
Team or Group #(if applicable):
Experiment or Assignment #: Lab03 Lab Meeting Day & Time:

Title of Report:

Lab#3

Digital Filtering and Spectral Effect


Signal Processing with Labs ECET350

Objectives:

 To learn how to determine the difference equation given FIR (Finite-impulse


response) or IIR (Infinite Impulse Response) system coefficients.
 To learn how to determine the FIR transfer function based on the given difference
equation, and learn how to calculate and display frequency responses of the FIR
system and perform digital filtering.
 To learn how to determine the IIR transfer function based on the given difference
equation, and learn how to calculate and display frequency responses of the IIR
systems and perform digital filtering.
 To use Simulink FIR design tool to design various types of filters and demonstrate
the filtering process by composite input signals.

Introduction

A digital filter is described in Figure 1, where x (n) and y (n) are the DSP filter input and
filter output, respectively

Figure 1. Digital filter with the input and output

The digital filter operates based on the following difference equation

y ( n )=bo x ( n )+ b1 x ( n−1 )+ …+b M x ( n−M )−a 1 y ( n−1 ) −…−a N y (n−N )

Where b o ,b 1 , … , b M and a 1 , a2 , … , a N are coefficients of the system; n is the discrete-time


index. Digital filter can also be represented by its transfer function by taking the z-
transform of the difference equation as

−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 2. Frequency response of the bandpass filter

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

An FIR system is specified by the numerator coefficients: b :[0.20.3 0.4 ].

a. Determine its transfer function H ( z )=¿

b. Determine its difference equation y ( n )=¿

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))

Using the standard MATLAB function “filter()” for verification:

yy = filter([0.2 0.3 0.4],1,sample)

Is the vector containing y(3:1:length(sample)) same as the vector yy?

d. Two FIR system coefficients are given below, respectively,

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.

MATLAB>>freqz(bLP,1,512,8000); % sampling rate=8000 Hz

Label and print your graph.


Perform similar operations for FIR systems with coefficients: bBP and label and print your
plots.

iii. Generate the sum of sinusoids for duration of 1 second:

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.

Hint: MATLAB>> t=0:(1/8000):1.0;


>> x=5*cos(1000*pi*t)+5*cos(2400*pi*t+0.25*pi)...
+5*cos(3600*pi*t+0.5*pi);

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

You might also like