Experiment 4
Experiment 4
Experiment No. 4:
Discrete Time Signal and Properties
Introduction
The signals which are defined only at discrete instants of time are known as discrete time signals. The discrete
time signals are represented by x(n) where n is the independent variable in time domain.
A signal which is specified at discrete instants of time is said to be a discrete-time signal or simply a
discrete signal. Discrete signals occur either due to the nature of the process, e.g. the variation in the number of
cars crossing the border every day, or due to the sampling process.
Objective
[x,n]=impseq(1,-10,20)
stem(n,x);
xlabel('time index n');
ylabel('Amplitude');
title('Unit Sample Sequence');
axis([-10 20 0 1.2]);
1
Example-2
[x,n]=impseq(30,-20,120);
stem(n,x);
xlabel('Time index n');
ylabel('Amplitude');
title('Unit Impulse Sequence');
axis([-20 120 0 1.2]);
2
Example-3
[x,n]=stepseq(5,-20,10);
stem(n,x);
xlabel('Time index n');
ylabel('Amplitude');
title('Unit Step Sequence');
axis([-20 10 0 1.2]);
3
Example-4
[x,n]=stepseq(-5,-20,20);
stem(n,x);
xlabel('Time index n');
ylabel('Amplitude');
title('Unit Step Sequence');
axis([-20 20 0 1.2]);
4
Issues
We did not face any issues in this experiment.
Conlcusion
A discrete-time signal is a sequence of values that correspond to particular instants in time. The time
instants at which the signal is defined are the signal's sample times, and the associated signal values are the
signal's samples.
Applications
The following are some applications of DT signals:
5
Lab Assignment Solution
Q1- y[n] = nx[n] 0< =n <20
n=[0:20];
x=[(n)>=0];
y=n.*x;
stem(n,y);
xlabel('Time Index n1');
ylabel('Amplitude');
title('y[n]=nx[n]');
Q2: x(n) = {0 1 1 1 1 0.5 0.5} Generate and plot the following samples.
x[n]
6
a) x[n-2]
[y,n]=sigshift(x,n1,2);
stem(n,y);
xlabel('Tine Index n1');
ylabel('Amplitude');
title('x[n-2]');
7
b) x[4-n]
[x1,n1]=sigfold(x,n1);
[y,n]=sigshift(x1,n1,-4);
subplot(2,1,1), stem(n1,x1);
subplot(2,1,2), stem(n,y);
subplot(2,1,1);
xlabel('Time Index n1');
ylabel('Amplitude');
title('x[-n]');
subplot(2,1,2);
xlabel('Time Index n1');
ylabel('Amplitude');
title('x[4-n]');
8
c) x[n+2]
[y,n]=sigshift(x,n1,-2);
figure;
stem(n,y);
xlabel('Time Index n1');
ylabel('Amplitude');
title('x[n+2]');
9
d) x[n]u[2-n]
[u,n1]=stepseq(0,-3,3);
[u1,n1]=sigfold(u,n1);
[u2,n1]=sigshift(u1,n1,-2);
[y,n]=sigmult(x,n1,u2,n1);
subplot(3,1,1), stem(n1,x);
subplot(3,1,2), stem(n1,u2);
subplot(3,1,3), stem(n,y);
subplot(3,1,1)
ylabel('x[n]');
subplot(3,1,2)
ylabel('u[2-n]');
subplot(3,1,3)
ylabel('x[n]u[2-n]');
10
e) x[n-1] δ[n-3]
[x1,n1]=sigshift(x,n1,1);
[d,n1]=impseq(0,-3,3);
[d1,n1]=sigshift(d,n1,3);
[y,n]=sigmult(x1,n1,d1,n1);
figure;
subplot(3,1,1), stem(n1,x1);
subplot(3,1,2), stem(n1,d1);
subplot(3,1,3), stem(n,y);
subplot(3,1,1);
ylabel('x[n-1]');
subplot(3,1,2);
ylabel('δ[n-3]');
subplot(3,1,3);
ylabel('x[n-1]δ[n-3]');
11
f) even part of x[n]
12
g) odd part of x[n]
13
Q3 x(n) = {1,-2,4,6,-5,8,10} Generate and plot the following sequences.
x=[1 -2 4 6 -5 8 10];
n=[-4 -3 -2 -1 0 1 2];
stem(n,x);
xlabel('Time Index n');
ylabel('x[n]');
14
a) x1[n] = 3x[n+2]+x[n-4]-2x[n]
[x1,n]=sigshift(x,n,-2);
x1=3.*x1;
[x2,n]=sigshift(x,n,4);
x3=-2.*x;
[y0,n]=sigadd(x2,n,x3,n);
[y,n]=sigadd(x1,n,y0,n);
stem(n,y);
xlabel('Time Index n');
ylabel('Amplitude');
title('x1[n]');
15
b) x2[n] = 5x[5+n]+4x[n+4]+3x[n]
x=[1 -2 4 6 -5 8 10];
n=[-4 -3 -2 -1 0 1 2 ];
[x1,n]=sigshift(x,n,-5);
x1=5.*x1;
[x2,n]=sigshift(x,n,-4);
x2=4.*x2;
[y0,n]=sigadd(x1,n,x2,n);
x3=3.*x;
[y,n]=sigadd(y0,n,x3,n);
stem(n,y);
xlabel('Time Index n');
ylabel('Amplitude');
title('x2[n]');
16
c) x[n+4]x[n-1]+x[2-n]x[n]
x=[1 -2 4 6 -5 8 10];
n=[-4 -3 -2 -1 0 1 2 ];
[x1,n]=sigshift(x,n,-4);
[x2,n]=sigshift(x,n,1);
[y1,n]=sigmult(x1,n,x2,n);
[x3,n]=sigfold(x,n);
[x4,n]=sigshift(x3,n,-2);
[y2,n]=sigmult(x4,n,x,n);
[y,n]=sigadd(y1,n,y2,n);
stem(n,y);
xlabel('Time Index n');
ylabel('Amplitude');
title('x3[n]');
17
18