AIR UNIVERSITY AEROSPACE AND AVIATION CAMPUS KAMRA
Department of Electrical Engineering
EE433 Digital Signal
Processing
(Lab
Manual)
Instructors: Engr. Muhammad Zain Ul Abideen
1
2
D I G I TA L S I G N A L P R O C E S S I N G
Lab Manual
Name: _____________________
Roll No: _____________________
Class: _______ __
3
ã Air University, Aerospace and Aviation Campus Kamra
Some Words of Caution:
Static Precautions:
This kit uses CMOS semiconductor devices which can be damaged by static electricity if
improperly handled, and even if you can’t feel the shock. Always wear a properly
grounded anti-static wrist strap when assembling this kit. DON’T remove semiconductor
components from their protective anti-static. Package until you are ready to install them
on the circuit board.
If possible, avoid wearing synthetic clothing to minimize the chance of static buildup. If
you must wear synthetic clothing make certain your wrist strap is properly grounded
before working on the kit. Other sources of static include plastic covered furniture
cushions and rubber or plastic wheels on carpeting.
RF Precautions
This equipment is intended for use in a laboratory test environment only. It generates,
uses, and can radiate radio frequency energy and has not been tested for compliance with
the limits of computing devices pursuant to subpart J of part 15 of FCC rules, which are
designed to provide reasonable protection against radio frequency interference. Operation
of this equipment in other environments may cause interference with radio
communications, in which case the user at his own expense will be required to take
whatever measures necessary to correct this interference.
Laboratory Policy on Common Work:
It i s assumed that you will be working with your lab partner/s when performing any
experiment in the lab. Thus, the results and analyses may be common to some extent.
Indicate who your lab partner/s is/are on all common work. Turning in someone else's
work (that is, work not done by either you or you and your lab partner/s) for a grade i s
grounds for an F in the course.
LAB NOTEBOOK
You are required to maintain a lab (engineering) notebook in the electrical
engineering laboratory courses.
Lab notebooks are customarily used in engineering as permanent records of
experimentation (or engineering) done. In engineering and research, it is often necessary
to either go back to work done at an earlier date or have records to prove that you
invented something being patented.
4
Your lab notebook should be a permanent record of your experimentation (or
engineering). You are required to make entries in it as you do the experimentation (or
engineering) and analyze the results.
OUTER COVER:
The outer cover should have course name, your name, roll number, discipline, class,
section and semester on it.
FIRST PAGE:
The first page should be used as an index or table of contents. List all experiments on it.
RECORDING EACH LAB:
Each lab should contain the following parts: (The order may vary for different labs, and
some of the parts listed may not apply to all labs.)
1. Title: This should include the title of the lab and the lab n u m b e r .
2. Objectives: Briefly state the purpose of the experiment and the concepts to be
investigated.
3. Equipment list: List all critical equipment and instruments used. Include the
manufacturer's name, model number, and serial number (or laboratory number)
should not be listed. Equipment can be listed either in an initial list or as used. You
should have enough information to go back and repeat the lab with the same
equipment.
4. Block diagrams you have to draw block diagrams of all the experiments that you
will implement(This will almost always save you time in the end since without a
good design diagram to work from, you will make more mistakes, have more
difficulty taking data, and have more difficulty troubleshooting your circuits.)
5. Data: Data should be tabulated in vertical columns. Data tables should be labeled.
Listing the units at the top of a column i s usually preferred to repeating the same unit
with each data entry.
6. Calculations: Include sample calculations of each type. (Include enough to show
how the calculations were done; however, do not use your notebook as a worksheet.)
7. Graphs: Include curves of data, wave shape diagrams, etc. Each curve or diagram
should have a title. When plotting curves, the independent variable should be on
horizontal axis. Use scales that are easily interpolated and consistent with the
5
accuracy of the data. Draw the vertical and horizontal axis inside the border of the
graph paper, and label the variable and units on each axis. Draw small circles around
each data point, and draw the best smooth curve through the data.
8. Analysis and Conclusions: Discuss and evaluate the results. Don't just present the
results, but interpret what they mean. If you get an unexpected result, explain why it
is unexpected and what may be the cause of the error. Be clear and concise.
9. Procedural Explanations: As you do the experiment, include brief statements of
what you are doing. Another person should be able to follow what you did.
SUGGESTIONS:
1. The lab notebook should be independent of the lab manual or instructions. It should
“make sense" without referencing back to the lab manual or instructions. Brief
procedural statements should be included as needed. Questions should be rewritten as
statements of fact.
2. Extra pages such as curves plotted on graph paper, computer printouts, etc. should
be attached in the lab notebooks (glue, staple, or tape). Do not attach lab
handouts.
3. Note any special problem encountered in performing the experiment in your lab
notebook (i.e., erratic readings, etc.).
4. Use a consistent pattern of headings and subheadings.
5. Record observations directly. Recopying from scrap paper should be avoided. It is
important in engineering to develop the ability to record neat and readable data
directly. Time spent recopying is usually time wasted.
6. The following practices should be followed whenever a lab notebook is expected to
be used for legal (patent) purposes:
a. Use only a permanent bound notebook with numbered pages.
b. Use pen to make all entries. Cross out errors with a single Line, or write omit
inside the margin beside large errors, such as a whole page). Do not erase or tear
out pages. (Crossing out incorrect data with a single line a not erasing is also a
good practice since discarded data may turn out to be useful later on.)
6
----------------------LAB# 01--------------------
MATLAB SIMULATION OF
DISCRETE TIME SIGNALS: TIME
DOMAIN REPRESENTATION
Objectives:
1. To extract some key properties of the original signal using specific digital signal
processing algorithms.
2. To investigate the properties of a discrete-time system by observing the output
signals for specific input signals.
3. To learn first how to generate in the time domain some basic discrete-time signals
in MATLAB and perform elementary operations on them, which are the main
objectives of this first exercise.
4. A secondary objective is to learn the application of some basic MATLAB
commands and how to apply them in simple digital signal processing problems.
Suggested equipment:
Matlab installed PC
MATLAB Commands Used
The MATLAB commands you will encounter in this exercise are as follows:
Operators and Special Characters
: . % + - * / ;
Elementary Matrices and Matrix Manipulation
ones rand zeros eye magic
Elementary Functions
Any all exp imag real isreal isequal sin cos ;
Data Analysis
Sum
7
Two-Dimensional Graphics
Axis grid legend plot
Stem title xlabel ylabel
General Purpose Graphics Functions
Clf subplot
Signal Processing Toolbox
Sawtooth Square
For additional information on these commands, see the MATLABReference Guide
[Mat05] or type help command name in the Command window.
Introduction:
1. Unit Sample and Unit Step Sequences
The unit sample sequence, often called the discrete-time impulse or the unit
impulse, denoted by δ[n], is defined by
δ[n] =1, for n = 0,
0 for n ≠ 0 (1)
The unit step sequence, denoted by µ[n], is defined by
µ[n] = 1, for n ≥ 0,
0 for n < 0 (2)
Project: Unit Sample and Unit Step Sequences
Two basic discrete-time sequences are the unit sample sequence and the unit step
sequence of Equations 1 and 2. A unit sample sequence u[n] of length N can b
generated using the MATLAB command
u = [1*zeros(1,N -1)];
A unit sample sequence ud[n] of length N and delayed by M samples, where M <
N, can be generated using the MATLAB command
ud = [zeros(1,M) 1 zeros(1,N - M - 1)];
Likewise, a unit step sequence s[n] of length N can be generated using the
MATLAB command
s = [ones(1,N)];
A delayed unit step sequence can be generated in a manner similar to that used in
the generation of a delayed unit sample sequence.
Program P1 _1 can be used to generate and plot a unit sample sequence.
8
Lab Exercise 1:
1. Run Program P1 _1 to generate the unit sample sequence u[n] and display it.
2. What are the purposes of the commands clf, axis, title, xlabel, and ylabel?
3. Modify Program P1 _1 to generate a delayed unit sample sequence ud[n] with a
delay of 11 samples. Run the modified program and display the sequence generated.
9
4. Modify Program P1 _1 to generate a unit step sequence s[n]. Run the modified
program and display the sequence generated.
5. Modify Program P1_ 1 to generate a delayed unit step sequence sd[n] with an
advance of 7 samples. Run the modified program and display the sequence
generated
10
Lab Exercise 2
1. Run Program P_ 2 and generate the complex-valued exponential sequence.
2. Which parameter controls the rate of growth or decay of this sequence? Which
parameter controls the amplitude of this sequence?
3. What will happen if the parameter c is changed to (1/12)+(pi/6)*i?
11
4. What are the purposes of the commands, real and imag?
5. What is the purpose of the command subplot?
6. Run Program P_ 3 and generate the real-valued exponential sequence.
7. Which parameter controls the rate of growth or decay of this sequence? Which
parameter controls the amplitude of this sequence?
8. What is the difference between the arithmetic operators ^ and .^?
9. What will happen if the parameter a is less than 1? Run Program P_ 3 again with
the parameter “a” changed to 0.9 and the parameter K changed to 20
12
Lab Exercise 3
1. Run Program P_4 to generate the sinusoidal sequence and display it.
2. What is the frequency of this sequence and how can it be changed? Which
parameter controls the phase of this sequence? Which parameter controls the
amplitude of this sequence? What is the period of this sequence?
3. What is the length of this sequence and how can it be changed?
4. Compute the average power of the generated sinusoidal sequence.
5. What are the purposes of the axis and grid commands?
13
6. Modify Program P1_4 to generate a sinusoidal sequence of frequency 0.9 and
display it. Now, modify Program P1_4 to generate a sinusoidal sequence of
frequency 1.1 and display it. Compare this new sequence with the one generated in
previous task. Comment on your results.
7. Modify the above program to generate a sinusoidal sequence of length 50,
frequency 0.08, amplitude 2.5, and phase shift 90 degrees and display it. What is
the period of this sequence?
14
8. Replace the stem command in Program P1_4 with the plot command and run the
program again. What is the difference between the new plot and the one generated
by using stem command?
15
Conclusion:
16