0% found this document useful (0 votes)
7 views10 pages

Exp 1 - DSP

Uploaded by

VIKASH RAJ
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)
7 views10 pages

Exp 1 - DSP

Uploaded by

VIKASH RAJ
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/ 10

SHERSHAH ENGINEERING COLLEGE, SASARAM

DEPARTMENT: Electrical & Electronics Engineering


Class: EEE -VI Semester
LABORATORY: Digital Signal Processing Laboratory (PCC-EEE24)
Practical Experiment Instruction Sheet

Experiment No. 01

Aim: - Generation of Discrete-time signals-Impulse, Step, Ramp, Sinusoidal and Exponential.

Apparatus Required: MATLAB Software.

Theory:
A discrete signal or discrete time signal is a time series consisting of a sequence of quantities. In other
words, it is a time series that is a function over a domain of integers. Unlike a continuous time signal, a
discrete time signal is not a function of a continuous argument; however, it may have been obtained by
sampling from a continuous time signal, and then each value in the sequence is called a sample. When a
discrete time signal obtained by sampling a sequence corresponds to uniformly spaced times, it has an
associated sampling rate; the sampling rate is not apparent in the data sequence, and so needs to be
associated as a characteristic unit of the system.
Discrete-time signals are represented mathematically as sequences of numbers. A sequence of numbers
x, in which the nth number in the sequence is denoted x[n], is formally written as
x = {x[n]}, −∞ < n < ∞,
where n is an integer. In a practical setting, such sequences can often arise from periodic sampling of an
analog (i.e., continuous-time) signal xa(t). In that case, the numeric value of the nth number in the
sequence is equal to the value of the analog signal, xa(t ), at time nT : i.e.,
x[n] = xa(nT ), −∞ < n < ∞.
The quantity T is the sampling period, and its reciprocal is the sampling frequency.

Department of Electrical & Electronics Engineering 2020-21


Program 1(a):

% Unit Impulse discrete Signal

close all;
clear all;
clc;
N=input('Enter Number of Samples, N = ');
n=-N:N

delta=zeros(1,2*N+1)

disp( '.....OUTPUT for Unit Impulse discrete Signal ......... ');


for i=N+1
delta(1,i)=delta(1,i)+1
end

stem(n,delta,'color','red');
xlabel('Time');
ylabel('Amplitude');
title('Unit Impulse discrete Signal');

Output 1(a):

Enter Number of Samples, N = 10

n=

-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10

delta =

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

.....OUTPUT for Unit Impulse discrete Signal .........

delta =

0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0

Department of Electrical & Electronics Engineering 2020-21


Program 1(b):

% Unit Step discrete Signal

close all;
clear all;
clc;
N=input('Enter Number of Samples, N = ');
n=-N:N

u=zeros(1,2*N+1)

disp( '.....OUTPUT for Unit Step discrete Signal ......... ');


for i=N+1:2*N+1
u(1,i)=u(1,i)+1
end

stem(n,u,'^-
','LineWidth',3,'color','green','MarkerSize',7,'MarkerFaceColor','cyan','Mar
kerEdgeColor','magenta');
axis([-7 7 -0.5 1.5]);
xlabel('Time');
ylabel('Amplitude');
title('Unit Step discrete Signal');
grid on;

% Sinusoidal discrete Signal


y=(10*cos(0.125*pi*n)).*u
figure(2)

Department of Electrical & Electronics Engineering 2020-21


subplot(2,1,1)
stem(n,y,'o-
','LineWidth',1,'color','black','MarkerSize',8,'MarkerFaceColor','yellow','M
arkerEdgeColor','blue');
xlabel('Time');
ylabel('Amplitude');
title('Sinusoidal discrete Signal');
grid on;

% Exponential discrete Signal


a=input('Enter the base, a = ');
x=(10*(a.^n)).*u
subplot(2,1,2)
stem(n,x,'o-
','LineWidth',1,'color','black','MarkerSize',8,'MarkerFaceColor','yellow','M
arkerEdgeColor','white');
xlabel('Time');
ylabel('Amplitude');
title('Exponential discrete Signal');
grid on;

Output 1(b):

Enter Number of Samples, N = 7

n=

-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7

u=

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

.....OUTPUT for Unit Step discrete Signal .........

u=

0 0 0 0 0 0 0 1 0 0 0 0 0 0 0

u=

0 0 0 0 0 0 0 1 1 0 0 0 0 0 0

u=

0 0 0 0 0 0 0 1 1 1 0 0 0 0 0

Department of Electrical & Electronics Engineering 2020-21


u=

0 0 0 0 0 0 0 1 1 1 1 0 0 0 0

u=

0 0 0 0 0 0 0 1 1 1 1 1 0 0 0

u=

0 0 0 0 0 0 0 1 1 1 1 1 1 0 0

u=

0 0 0 0 0 0 0 1 1 1 1 1 1 1 0

u=

0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

y=

0 0 0 0 0 0 0 10.0000 9.2388 7.0711 3.8268 0.0000 -


3.8268 -7.0711 -9.2388

Enter the base, a = 0.4

x=

0 0 0 0 0 0 0 10.0000 4.0000 1.6000 0.6400 0.2560


0.1024 0.0410 0.0164

Department of Electrical & Electronics Engineering 2020-21


Department of Electrical & Electronics Engineering 2020-21
Program 1(c):

% Unit Ramp discrete Signal

close all;
clear all;
clc;
N=input('Enter Number of Samples, N = ');
n=-N:N

r=zeros(1,2*N+1)

disp( '.....OUTPUT for Unit Ramp discrete Signal ......... ');


for i=N+1:2*N+1
r(1,i)=n(1,i)
end

stem(n,r,'o-
','LineWidth',3,'color','green','MarkerSize',2,'MarkerFaceColor','cyan','Mar
kerEdgeColor','magenta');

xlabel('Time --->');
ylabel('Amplitude .....>>');
title('Unit Ramp discrete Signal');
grid on;

Output 1(c):

Enter Number of Samples, N = 12

n=

-12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9


10 11 12

r=

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0

.....OUTPUT for Unit Ramp discrete Signal .........

r=

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0

r=

Department of Electrical & Electronics Engineering 2020-21


0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
0 0

r=

0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0
0 0

r=

0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 0 0 0 0 0 0 0
0 0

r=

0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 0 0 0 0 0 0
0 0

r=

0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 0 0 0 0 0
0 0

r=

0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 0 0 0 0
0 0

r=

0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 0 0 0
0 0

r=

0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 0 0
0 0

r=

Department of Electrical & Electronics Engineering 2020-21


0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 0
0 0

r=

0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10
0 0

r=

0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10
11 0

r=

0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10
11 12

Department of Electrical & Electronics Engineering 2020-21


Conclusion:

Questions:

Q.1: Write a command to generate a column vector having five zeros.


Answer:

Q.2: What will be happen if base a of exponential signal function is taken as unity?

Answer:

Q.3: Write a command which will convert a discrete graph into a continuous graph.
Answer:

Assessment:
Cognitive Affective Psychomotor Total
(Out of 3) (Out of 3) (Out of 3) (Out of 9)

Sign of the faculty with Date

Department of Electrical & Electronics Engineering 2020-21

You might also like