0% found this document useful (0 votes)
47 views4 pages

DSP Lab - 1 CE

This document provides instructions for Lab 1 on signals in MATLAB for the Digital Signal Processing Lab course. The objectives of the lab are to introduce students to signal transformations using MATLAB, including analyzing signals, calculating signal properties, time-shifting, time-compression/expansion, and even and odd signals. The document outlines two tasks for students to complete. Task 1 involves plotting and analyzing a sinusoidal signal, and estimating properties of a continuous-time signal from discrete-time statistics. Task 2 consists of defining a nonuniform discrete-time signal, developing a function to time-shift signals, and implementing a unit step function in MATLAB. Students are instructed to work in pairs, seek help as needed, and include MATLAB code, results,

Uploaded by

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

DSP Lab - 1 CE

This document provides instructions for Lab 1 on signals in MATLAB for the Digital Signal Processing Lab course. The objectives of the lab are to introduce students to signal transformations using MATLAB, including analyzing signals, calculating signal properties, time-shifting, time-compression/expansion, and even and odd signals. The document outlines two tasks for students to complete. Task 1 involves plotting and analyzing a sinusoidal signal, and estimating properties of a continuous-time signal from discrete-time statistics. Task 2 consists of defining a nonuniform discrete-time signal, developing a function to time-shift signals, and implementing a unit step function in MATLAB. Students are instructed to work in pairs, seek help as needed, and include MATLAB code, results,

Uploaded by

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

Department of Computer Engineering

CE303L: Digital Signal Processing Lab

Course Instructor: Dr. Mahboob-ur-Rahman Dated: 1st October, 2021

Lab Instructor: Tawahaa Ahmed Semester: 5th

Class: BSCE-19 Session: Fall-2021

Lab 1. Signals in MATLAB

Lab Marks Obtained


Name Roll No VIVA(5)
(10) Marks (15)

Checked on: _______________________________


Signature: ______________________________
1.1 Objectives
This Lab experiment has been designed to introduce students to signal transformations
using MATLAB
 Analyzing signal in Matlab.
 Calculating Energy, RMS value of signals.
 How to perform time-shifting
 How to perform time-compression/expansion
 Even and odd signals

1.2 Lab Instructions


a. The tasks that are completed during the allocated lab time will be graded. However the
students are encouraged to complete all tasks on their own for practice.
b. The students are required to work in groups of two. Every group member is expected
to contribute equally to the completion of the lab and achieve the learning objectives.
c. In case some aspect of the lab is not understood, the students are advised to seek help
from the lab engineer and the assigned Teaching Assistant (TA).
d. All questions should be answered precisely to get maximum credit. Lab report must
ensure following items:
 Matlab codes
 Results (graphs/tables) duly commented and discussed
 Proper discussion accompanying the answers.

1.3 Lab Tasks


1.3.1 Task # 1 [5 Marks]
Use following code to generate a signal
>>n=1:50;
>> s = sin(2*pi*n/50);
(a) Use stem to plot the signal. Make sure that you include:
• The figure itself.
• An x-axis label and a y-axis label.
• A figure number and a caption that describes the figure.
(b) Calculate the following statistics over the length of the signal (i.e., let n1 = 1
and n2 = length(s)), and include your results in your report.
• Maximum value
• Minimum value
• Mean value
• Mean squared value
• RMS value
• Energy
(c) (Approximating continuous-time statistics in discrete-time) Suppose that s is the result of
sampling a continuous-time signal with a sampling interval Ts = 1/100. Use the discrete-time
statistics to estimate the following statistics for the continuous-time signal s(t) = sin(4πt):
• Signal duration
• Energy
• Average power
• RMS Value

1.3.2 Task # 2 [5 Marks]


Basic transformation of signals
a. Transformations of the Time Index for Discrete time signals:
i) Define a Matlab vector n representing a DT signal to be time indexed from -3
≤ n < 7 and the Matlab vector x to be the values of the signal x[n] at those
samples:
2, 𝑛=0
3, 𝑛=2
−1, 𝑛=3
𝑥[𝑛] =
2, 𝑛=5
−3, 𝑛=6
{0, 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒

Enter the Matlab command(s) through which you defined this vector in your
report.

ii) Develop a general function that can shift any given signal x[n] by any desired
time delay nd to produce x[n - nd]. When nd is positive, the signal will be shifted
rightwards while for negative nd, the signal will be shifted leftwards. Your
function should automatically plot both the original signal x[n] and the shifted
signal x[n - nd]

Hint: You can use ‘find’ command of Matlab. Explore what ‘find’ does in
Matlab’s function browser.

For this question assume x[n] to be the function defined in the previous part as
the input signal x[n] to your function.

First, choose nd as 5. Attach a screenshot of the output of your function in your


report. Plot both x[n] and x[n - 5] and properly label both figures.

Now choose nd as -5. Attach a screenshot of the output of your function in your
report. Plot both x[n] and x[n+5] and properly label both figures.

You should also copy/paste your function in the report.


b. Implement the following finite-duration DT unit-step function in Matlab. Your
function should take ni and nh as input from user.
1, 𝑛𝑖 ≤ 𝑛 ≤ 𝑛ℎ
𝑢(𝑛) = {
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒

Your Matlab function should plot this function for whatever value of ni and nh is
input.

Attach a screenshot of the figure generated by your function for the input values of
ni = 4 and nh = 7. Also copy the function to your report.

You might also like