0% found this document useful (0 votes)
23 views12 pages

DSP Lab 2

This document is a lab report on digital signal processing. It contains 8 tasks completed during the lab and 1 task for post lab analysis. The tasks involve generating and manipulating different types of signals including cosine, exponential, step, impulse and piecewise signals using MATLAB. Code and output is provided for each task.
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)
23 views12 pages

DSP Lab 2

This document is a lab report on digital signal processing. It contains 8 tasks completed during the lab and 1 task for post lab analysis. The tasks involve generating and manipulating different types of signals including cosine, exponential, step, impulse and piecewise signals using MATLAB. Code and output is provided for each task.
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/ 12

Digital Signal Processing

EEE-324
Lab Report 02

Name Muhammad Sharjeel

Registration FA21-BEE-130
Number

Class BEE-6B

Instructor’s Name Sir Mubeen Sabir

Lab Assessment
Post Lab Total
In-Lab
Data Presentation Data Analysis Writing Style

1
Introduction to Discrete Time Signal Processing on MATLAB
Objectives:
• To understand basic concept of discrete time signals and their representation on MATLAB.

In-Lab:
Task # 01:
Generate a continuous time cosine signal and plot it.
Code:

Output:

Task # 02:
Generate a discrete time exponential signal and plot it.

Code:

2
Output:

Task # 03:
Write a MATLAB program for the ‘running_total’, a running total is a sequence of partial sum of
a given sequence or signal. For example, the running total of the signal {a, b, c,…} are a, a+b,
a+b+c… Use that program to find running total of discrete time signal of length N =100. Write
your program so that it is flexible. That is, you should be able to invoke your program from the
command window as follows:

>> y =running_total(x)

Where x is the input signal, and y is the running total of that signal.

Code:

3
Output:

Task # 04:
Write a program to compute variance and mean of a signal x. The variance σ2 is define to be:

4
1
σ2 = ∑𝑁
𝑖=1(𝑥𝑖 − 𝑥̅ )
2
𝑁
where x̅ denotes the mean of the signal x. For signal x use, all the integers from 1 to 1000.

Code:

Output:

Task # 05:
Can u explain what the following program does.

Code:

Output:

5
As we can see form the above output x is a vector in which we have values greater than equal to
zero and values less than zero. For values less than zero output is -1 and for values greater than
equal to zero output is original values of x vector.

Task # 06:
Generate a step sequence u[n] as described below, use it to generate an impulse as δ[n] = u[n] –
u[n-1].

Code:

6
Output:

Task # 07:
Generate an impulse sequence δ[n] as described below, use it to generate step sequence.

u[n] = ∑𝑘 𝛿[𝑛 − 𝑘]

Code:

7
Output:

Task # 08-a:
Generate the following sequences using step and impulse sequence.

x[n] = u[n] – u[n-10]

Code:

8
Output:

Task # 08-b:
x[n] = an u[n]

Code:

9
Output:

Task # 08-c:
∑ an δ[n – k], k = -10 to 10

Code:

10
Output:

Post Lab:

Task # 01:
sin⁡[𝜋𝑛], −10 ≤ 𝑛 ≤ 10
𝑥[𝑛] = {
0, 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
Also plot x[n]δ[n].
Code:

11
Output:

Critical Analysis:
In this lab we have learned how to plot sinusoidal and exponential signals in MATLAB. We have
also learned how to use subplot, and legend command in MATLAB. Furthermore, we have studied
how to use if else and for loop in MATLAB. In addition, we have also learned how to make
functions in MATALB. In the last we create a piecewise signal and plot it in discrete domain.

12

You might also like