This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up**This preview shows
pages
1–3. Sign up
to
view the full content.*

6.02 Spring 2008
1
of
9
Lab #7
M
ASSACHUSETTS
I
NSTITUTE OF
T
ECHNOLOGY
D
EPARTMENT OF
E
LECTRICAL
E
NGINEERING AND
C
OMPUTER
S
CIENCE
6.02: Introduction to EECS II
Spring 2008
Lab #7: Digital Signal Processing
Goal:
Design a digital circuit that implements a low-pass filter with a cut-off frequency
of 1/8 of the sample rate.
Verify the design using the JSim logic simulator and Matlab.
Instructions:
1.
Complete the pre-lab (see first section below).
There are questions to be
answered; please write your responses on a separate sheet of paper and turn them
in at the beginning of lab on Wednesday.
2.
Complete the activities for Wednesday’s lab (see second section below).
3.
Prepare the requested material and think about the questions posed on the Check-
off Sheet, then find a staff member to complete your post-lab interview.
Pre-lab (due in lab, Wed., April 9, 2008)
In this week’s lab we’ll be designing a digital low-pass filter with a cutoff frequency of
1/8 of the sample rate.
In the pre-lab we’ll use Matlab to help develop the design
parameters of the filter.
Then in the lab we’ll design and test the logic itself using JSim,
and then use Matlab at the very end to look at the FFT of the filter’s output on some test
data.
Step 1: Decide on filter architecture; calculate coefficients
There are many choices for the architecture of a digital filter, varying in their logic
complexity, throughput, rate of frequency roll-off, flatness of response in the passband
and stopband, and stability when using integer arithmetic.
Matlab provides many
functions for designing filters as part of its Signal Processing Toolbox; we’ll make use
some of these below.
We’ll be using 2’s complement integer arithmetic in our filter design.
While this keeps
our logic simple and fast, it does introduce some quantization on the coefficient and data
values, which appears as additional high frequency noise in the output data.
This noise
can cause stability problems for some filter architectures, but happily the FIR filters
we’ve studied are good at handling this complication.
With FIR filters there is a tradeoff
we have to make between the number of taps and the steepness of the roll-off at the cut-

This
** preview**
has intentionally

6.02 Spring 2008
2
of
9
Lab #7
off frequency: more taps means steeper roll-off but also more logic.
Each design makes
this tradeoff differently; let’s use 11 taps for our design.
To get started, fire up Matlab on an Athena workstation:
athena%
add 6.02
athena%
It’s handy to have some test data on which to try our filter.
We’ll use a 48kHz sample
rate (this is a common sample rate in PC audio chips) and build a digital waveform
containing sine waves at frequencies of 500Hz, 1.5kHz, 3kHz, 6kHz, 9kHz, 12kHz,
15kHz and 18kHz. In the Matlab command window enter the following commands:
fs = 48000;
% sample frequency
n = 1024;
% number of samples
t = (1:n)/fs; % vector of n timepoints at 1/fs intervals
% generate our test signal
d = sin(2*pi*500*t) + sin(2*pi*1500*t) + sin(2*pi*3000*t);

This is the end of the preview. Sign up
to
access the rest of the document.

Ask a homework question
- tutors are online