0% found this document useful (0 votes)
20 views

Time Domain Analysis of DT Signals & Systems: Theory

This document contains the lab procedure and results for Experiment 2 of the Digital Signal Processing I Lab. The experiment covers time domain analysis of discrete-time signals and systems. It includes generating, delaying, advancing, adding, upsampling, downsampling, extracting even and odd parts, and convolving discrete-time sequences. Graphical outputs are provided for examples of unit impulse, unit step, unit ramp, sequence addition, upsampling/downsampling, even/odd parts extraction, and convolution.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Time Domain Analysis of DT Signals & Systems: Theory

This document contains the lab procedure and results for Experiment 2 of the Digital Signal Processing I Lab. The experiment covers time domain analysis of discrete-time signals and systems. It includes generating, delaying, advancing, adding, upsampling, downsampling, extracting even and odd parts, and convolving discrete-time sequences. Graphical outputs are provided for examples of unit impulse, unit step, unit ramp, sequence addition, upsampling/downsampling, even/odd parts extraction, and convolution.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Summer 2020 BUBT Dept.

of EEE

EEE 314: Digital Signal Processing I Lab


Experiment – 2

Time Domain Analysis of DT Signals & Systems


Theory:
Discrete-time (DT) signals are represented mathematically as sequences of numbers. DT signals are
defined at discrete times, and thus, the independent variable has discrete values. A DT system is defined
mathematically as a transformation or operator that maps an input sequence with values x[n] into an
output sequence with values y[n]. In this experiment, we will perform different DT sequence generation,
their delaying & advancing. We will also perform addition of two DT sequences, up-sampling & down-
sampling, even & odd part generation, and convolution. Finally, we will perform correlation of DT
sequences.

In discrete time, the unit impulse is simply a sequence that is zero except at n = 0, where it is unity. In
discrete time, the unit step is a well-defined sequence, being zero for n < 0, and unity for all other values
of n. The unit ramp is a sequence that is zero for n < 0, and n for all other values of n.

The process of converting the sampling rate of a digital signal from one rate to another is sampling rate
conversion. Increasing the rate of already sampled signal is up-sampling, whereas decreasing the rate is
called down-sampling. To up-sample by an integer factor N, we simply insert N–1 zeros between x[n]
and x[n+1] for all n. To down-sample, we select every Nth sample and discard the rest.

Convolution is a mathematical operation, just as multiplication, addition or integration. Addition takes


two numbers and produces a third number, while convolution takes two signals and produces a third
signal. In linear systems, convolution is used to describe the relationship between three signals of
interest: input signal, impulse response, and output signal. If we know a system's impulse response, then
we can calculate what the output will be for any possible input signal. This means we know everything
about the system.

Correlation is a mathematical operation that is very similar to convolution. Just as with convolution,
correlation uses two signals to produce a third signal. This third signal is called the cross-correlation of
the two input signals. If a signal is correlated with itself, the resulting signal is instead called the
autocorrelation.

Page 1 of 11
Summer 2020 BUBT Dept. of EEE

Lab Work:
Part A
A.1: Unit Impulse
n=-10:10;
impulse=((n-0)==0);
subplot(3,1,1),stem(n,impulse),title('Unit Impulse');
impulse=((n+2)==0);
subplot(3,1,2),stem(n,impulse),title('Advanced Unit Impulse');
impulse=((n-3)==0);
subplot(3,1,3),stem(n,impulse),title('Delayed Unit Impulse');

Output:
Unit Impulse
1

0.5

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

Advanced Unit Impulse


1

0.5

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

Delayed Unit Impulse


1

0.5

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

Figure 1 for Part A.1

Page 2 of 11
Summer 2020 BUBT Dept. of EEE

A.2: Unit Step


n=-10:10;
step=((n-0)>=0);
subplot(3,1,1),stem(n,step),title('Unit Step');
step=((n+3)>=0);
subplot(3,1,2),stem(n,step),title('Advanced Unit Step');
step=((n-2)>=0);
subplot(3,1,3),stem(n,step),title('Delayed Unit Step');

Output:
Unit Step
1

0.5

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

Advanced Unit Step


1

0.5

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

Delayed Unit Step


1

0.5

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

Figure 2 for Part A.2

Page 3 of 11
Summer 2020 BUBT Dept. of EEE

A.3: Unit Ramp


n=-10:10;
step=((n-0)>=0);
ramp=(n-0).*step;
subplot(3,1,1),stem(n,ramp),title('Ramp');
step=((n+4)>=0);
ramp=(n+4).*step;
subplot(3,1,2),stem(n,ramp),title('Advanced Ramp');
step=((n-3)>=0);
ramp=(n-3).*step;
subplot(3,1,3),stem(n,ramp),title('Delayed Ramp');

Output:
Ramp
10

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

Advanced Ramp
15

10

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

Delayed Ramp

0
-10 -8 -6 -4 -2 0 2 4 6 8 10

Figure 3 for Part A.3

Page 4 of 11
Summer 2020 BUBT Dept. of EEE

Part B
Addition of Two Sequence
x1=[2 4 1 6 4 9];
x2=[3 5 6 9];
n1=0:5;
n2=-1:2;
n=min(n1(1),n2(1)):max(n1(end),n2(end));
y1=zeros(1,length(n));
y2=y1;
y1((n>=n1(1))&(n<=n1(end)))=x1;
y2((n>=n2(1))&(n<=n2(end)))=x2;
y=y1+y2;
subplot(3,1,1),stem(n,y1),title('First Sequence');
subplot(3,1,2),stem(n,y2),title('Second Sequence');
subplot(3,1,3),stem(n,y),title('Addition');

Output:
First Sequence
10

0
-1 0 1 2 3 4 5

Second Sequence
10

0
-1 0 1 2 3 4 5

Addition
10

0
-1 0 1 2 3 4 5

Figure 4 for Part B

Page 5 of 11
Summer 2020 BUBT Dept. of EEE

Part C
Up-sampling & Down-sampling
n=1:60;
xs=sin(.3*n);
subplot(3,1,1),stem(xs),title('Normally Sampled');
y=upsample(xs,2);
subplot(3,1,2),stem(y),title('Upsampled');
y=downsample(xs,2);
subplot(3,1,3),stem(y),title('Downsampled');

Output:
Normally Sampled
1

-1
0 10 20 30 40 50 60

Upsampled
1

-1
0 20 40 60 80 100 120

Downsampled
1

-1
0 5 10 15 20 25 30

Figure 5 for Part C

Page 6 of 11
Summer 2020 BUBT Dept. of EEE

Part D
Even Part & Odd Part
n=-15:15;
step=((n+1)>=0);
x=(n+1).*step;
xf=fliplr(x);
even=(x+xf)/2;
odd=(x-xf)/2;
subplot(3,1,1),stem(n,x),title('Sequence');
subplot(3,1,2),stem(n,even),title('Even Part');
subplot(3,1,3),stem(n,odd),title('Odd Part');

Output:
Sequence
20

10

0
-15 -10 -5 0 5 10 15

Even Part
10

0
-15 -10 -5 0 5 10 15

Odd Part
10

-10
-15 -10 -5 0 5 10 15

Figure 6 for Part D

Page 7 of 11
Summer 2020 BUBT Dept. of EEE

Part E
Convolution
x1=[4 2 6 3 8 1 5];
x2=[3 8 6 9 6 7];
n1=-2:4;
n2=-4:1;
n=(n1(1)+n2(1)):(n1(end)+n2(end));
y=conv(x1,x2);
subplot(3,1,1),stem(n1,x1),title('1st Sequence');
subplot(3,1,2),stem(n2,x2),title('2nd Sequence');
subplot(3,1,3),stem(n,y),title('Convolution');

Output:
1st Sequence
10

0
-2 -1 0 1 2 3 4

2nd Sequence
10

0
-4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1

Convolution
200

100

0
-6 -4 -2 0 2 4 6

Figure 7 for Part E

Page 8 of 11
Summer 2020 BUBT Dept. of EEE

Part F
F.1: Auto-Correlation
x=[4 7 5 8 7 9 1 4];
nx=-2:5;
subplot(2,1,1),stem(nx,x),title('Sequence');
[r,n]=xcorr(x);
subplot(2,1,2),stem(n,r),title('AutoCorrelation');

Output:
Sequence
10

0
-2 -1 0 1 2 3 4 5

AutoCorrelation
300

200

100

0
-8 -6 -4 -2 0 2 4 6 8

Figure 8 for Part F.1

Page 9 of 11
Summer 2020 BUBT Dept. of EEE

F.2: Cross-Correlation
x1=[2 1 0 3 4 3 2 2];
x2=[3 4 6 5 3 7];
n1=-1:6;
n2=-4:1;
n=(n1(1)+n2(1)):(n1(end)+n2(end));
r=conv(x1,fliplr(x2));
subplot(3,1,1),stem(n1,x1),title('1st Sequence');
subplot(3,1,2),stem(n2,x2),title('2nd Sequence');
subplot(3,1,3),stem(n,r),title('CrossCorrelation');

Output:
1st Sequence
4

0
-1 0 1 2 3 4 5 6

2nd Sequence

0
-4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1

CrossCorrelation

60

40

20

0
-6 -4 -2 0 2 4 6 8

Figure 9 for Part F.2

Page 10 of 11
Summer 2020 BUBT Dept. of EEE

Discussion:
You can search any function on MATLAB website: https://www.mathworks.com/help/

Documentation link to some important functions are given below:

• zeros() https://www.mathworks.com/help/matlab/ref/zeros.html
• ones() https://www.mathworks.com/help/matlab/ref/ones.html
• upsample() https://www.mathworks.com/help/signal/ref/upsample.html
• downsample() https://www.mathworks.com/help/signal/ref/downsample.html
• fliplr() https://www.mathworks.com/help/matlab/ref/fliplr.html
• conv() https://www.mathworks.com/help/matlab/ref/conv.html
• xcorr() https://www.mathworks.com/help/matlab/ref/xcorr.html

 Comment after each output. Discuss why the output is the way it is (in each part). Lastly, write one
sentence for each of the seven functions mentioned above.

Page 11 of 11

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy