LAB MANUAL of DSP-1
LAB MANUAL of DSP-1
LAB MANUAL of DSP-1
COURSE: DSP-3105
Laboratory Manual
Prepared by: Supervised by:
Saiful Islam Dr. Md. Junaebur Rashid
Lecturer of ICT, BUP Associate Professor of EEE, DU
Experiment Name: Time domain analysis of discrete time signals
Objectives:
1. To understand the time domain properties of discrete time signals: unit impulse, unit step,
unit ramp, and exponential signals.
2. To learn how to generate and plot the discrete time signals in MATLAB.
Pre-Lab works
1. Read carefully the experiment manual before attending the lab.
2. See the theory lecture notes (bring them with you if necessary).
3. Practice the examples given in this experiment at home for better class performance.
4. Do not bring any relevant MATLAB codes, neither in any portable device nor in written
form.
5. Familiarize yourself with the MATLAB commands that may be required for this lab (see
the list).
Signals are broadly classified into analog and discrete signals. An analog signal will be denoted by
Xa(t), in which the variable t can represent any physical quantity, but we will assume that it
represents time in seconds. A discrete signal will be denoted by x(n), in which the variable n is
integer valued and represents discrete instances in time. Therefore it is also called a discrete-time
signal, which is a number sequence and will be denoted by one of the following notations:
x(n) = {x(n)} = {. . . , x(−1), x(0), x(1), . . .}
TYPES OF SEQUENCES
We use several elementary sequences in digital signal processing for analysis purposes. Their
definitions and MATLAB representations follow.
MATLAB Coding
In MATLAB the function zeros(1,N) generates a row vector of N zeros, which can be used to
implement δ(n) over a finite interval.
1 for n 0
u ( n) = {… ,0,0,1,1,1, … }
0 for n 0
MATLAB Coding
In MATLAB the function ones(1,N) generates a row vector of N ones. It can be used to generate
u(n) over a finite interval.
𝑢(𝑛) = 𝑛 𝑓𝑜𝑟 𝑛 ≥ 0
0 𝑓𝑜𝑟 𝑛 < 0
MATLAB Coding
% Program for the generation of Unit Ramp sequence
clc;
clear all;
close all;
n=-1:10;
x=[zeros(1,1),0:10];
stem(n,x)
xlabel('time')
ylabel('Amplitude')
title('Unit Ramp signal')
Alternative coding
% program for generation of ramp signal
clc;
clear all;
close all;
n1 = input('Enter the value for end of the sequence: '); %n1 = <any
value>10
x = 0:n1;
stem(x);
xlabel('time')
ylabel('Amplitude')
title('Unit Ramp signal')
In MATLAB an array operator “.^” is required to implement a real exponential sequence. For
example, to generate x(n) = (0.9)n, 0 ≤ n ≤ 10, we will need the following MATLAB script:
>> n = [0:10];
>> x = (0.9).^n;
MATLAB Coding
LAB WORK
1. Unit Impulse signal
a. Create Unit impulse signals, (n ) for n = -5:5
[Hint: Use the logical relation n==0 for implementing δ(n). For example, to implement
𝛿(𝑛) = 1 𝑓𝑜𝑟 𝑛 = 𝑛𝑜
0 𝑓𝑜𝑟 𝑛 ≠ 𝑛𝑜
over the n1 ≤n0 ≤n2 interval.]
b. Plot Unit Impulse signal Vs. n Using the MATLAB function stem ( ).
c. Level the X and Y coordinate and use a title of the generated signal.
Generate a ramp sequence shown in following figure using your own aptitude.
a. Write MATLAB script or m-file.
b. Plot Unit Ramp signal Vs. n Using the MATLAB function stem ( ).
c. Level the X and Y coordinate and use a title of the generated signals.
[You can code this program in different ways.]
4. Exponential sequence
Generate a real valued-exponential sequence shown in following figure using, a=0.85
a. Write MATLAB script or m-file.
b. Plot Real valued Exponential signal Vs. n Using the MATLAB function stem ( ).
c. Level the X and Y coordinate and use a title of the generated signals.
REPORT:
1. Submit a report on your lab work along with the corresponding MATLAB script file and
figure window for each work.
2. Clearly label x-axis, y-axis, and title in each figure.
3. Answer all the questions in Lab Work.
Warning
1. Don’t copy from your mates.
Reference
1. Digital Signal Processing Using MATLAB®, Third Edition Vinay K. Ingle, John G.
Proakis.