Time Domain Analysis of DT Signals & Systems: Theory
Time Domain Analysis of DT Signals & Systems: Theory
of EEE
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.
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
0.5
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
0.5
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
Page 2 of 11
Summer 2020 BUBT Dept. of EEE
Output:
Unit Step
1
0.5
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
0.5
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
0.5
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
Page 3 of 11
Summer 2020 BUBT Dept. of EEE
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
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
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
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
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
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
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
Page 10 of 11
Summer 2020 BUBT Dept. of EEE
Discussion:
You can search any function on MATLAB website: https://www.mathworks.com/help/
• 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