0% found this document useful (0 votes)
20 views5 pages

DSP Exp 2

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)
20 views5 pages

DSP Exp 2

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/ 5

CHITTAGONG UNIVERSITY OF ENGINEERING &

TECHNOLOGY
Department of Electrical & Electronic Engineering
Course Code: EEE 366
Course Title: Digital Signal Processing Sessional

Experiment 2

Topic: Time domain analysis of discrete time signals and systems.


Date of Submission: December 10 ,2024

Submitted By:
Name: Omar Abdullah
ID: 2002095
Section: B
Group: 2
Department of Electrical and Electronic Engineering
Chittagong University of Engineering & Technology (CUET)

Submitted To:
Mr. Kamrul Hasan Hira
Lecturer
Department of Electrical and Electronic Engineering
Chittagong University of Engineering & Technology (CUET)

VOLUME 11, 2023 1


Date of Submission 10.12.2024.
Digital Object Identifier

TIME DOMAIN ANALYSIS OF DISCRETE TIME


SIGNALS AND SYSTEMS
OMAR ABDULLAH, (Undergraduate Student),
Chittagong University of Engineering And Technology, Pahartoli, Raozan-4349 Chittagong, Bangladesh (e-mail: www.cuet.ac.bd)

‘‘This lab work was assigned by Mr. Kamrul Hasan Hira (Lecturer , Department of Electrical and Electronic Engineering,CUET’’

ABSTRACT An overview of time shifting, signal folding, signal addition, and the convolution sum—a key
function in discrete-time signal processing—is given in this paper. By defining a function and signal to add
two random discrete signals, we start by defining the time-shifting property of a discrete signal with the
subsequent signal reversal. The convolution sum is thus mathematically calculated using these properties,
and its importance in a variety of applications, including image processing, system analysis, and filtering, is
discussed. Next, we show how to use MATLAB, a potent signal processing tool, to implement the convolution
sum. To walk readers through the useful features of convolution in MATLAB, the paper provides illustrative
examples and code snippets.

I. OBJECTIVE y2=y1;
y1(find((n>=n1(1))&(n<=n1(end))))=x1;
T .he main objective here is to use and illustrate the
convolution sum using time shifting, signal folding, and
signal addition.The response y(n) is given by the following
y2(find((n>=n2(1))&(n<=n2(end))))=x2;
y=y1+y2;
relation, end
P∞
y(n) = n=−∞ x(k)h(nk) = x(n) ∗ h(n)
4) Function declaration for convolution
II. CODE AND GRAPH PLOT function [y,n] = conv_sig(x,nx,h,nh)
A. FUNCTION DECLARATION y = conv(x,h)
1) function declaration code for time shifting nys = nx(1) + nh(1);
function [y,n] = sigshift(x,m,n0) nye = nx(length(x))+nh(length(h));
n=m+n0; n = [nys:nye];
y=x end
end

B. CODE AND GRAPH OF Y[N] = X[N]*X[N-2]


2) function declaration for signal reversal 1) Code
function [y,n1] = sigfold(x,n) clc
y=fliplr(x) close all
n1=-fliplr(n) clear all
end x = [-2 1 4 3];
n = -2:1;
[x1 n1] = sigshift(x,n,2);
3) Function decelaration for signal addition [y ny] = conv_sig(x,n,x1,n1)
function [y,n] = sigadd(x1,n1,x2,n2)
n = min(n1(1),n2(1)):max(n1(end),n2(end)); stem(ny,y,’square’,’filled’,’color’,’red’)
y1=zeros(1,length(n)); title(’Discrete plot of y[n] = x[n]*x[n-2]’,’FontSize’’,20)

2 VOLUME 11, 2023


xlim([-3 5]) 2) Graph
xlabel(’ny’,’FontSize’,14,’FontName’,’Calibri’)
ylabel(’y[n]’,’FontSize’,14,’FontName’,’Calibri’)
ylim([-20 30])
set(gca,’xgrid’,’on’,’ygrid’,’on’)
legend(’discrete sample’,’location’,’northwest’)
print(′ dsp_exp2_classtask_1.jpeg′ ,′ −djpeg′ ,′ −r314′ )

2) Graph

FIGURE 2. Graphical representation of y[n] = x[n]*x[-n

D. CODE AND GRAPH OF Y[N] = X[-2N+1]

FIGURE 1. Graphical representation of y[n] = x[n]*x[n-2] 1) Code


clc
close all
C. CODE AND GRAPH OF Y[N] = X[N]*X[-N]
clear all
x = [-2 1 4 3];
1) Code
n = -2:1;
clc x1 = downsample(x,2);
close all
n1 = n(1:2:end);
clear all
x = [-2 1 4 3]; [x2 n2] = sigfold(x1,n1)
n = -2:1; [y ny] = sigshift(x2,n2,1)
[x1 n1] = sigfold(x,n)
stem(ny,y,’filled’,’MarkerSize’,10)
[y ny] = conv_sig(x,n,x1,n1)
title(’Discrete plot of y[n] = x[-2n+1]’,’FontSize’,20)
stem(ny,y,’square’,’filled’,’color’,’red’) xlim([0 4])
title(’Discrete plot of y[n] = x[n]*x[-n]’,’FontSize’,20) xlabel(’ny’,’FontSize’,14,’FontName’,’Calibri’)
xlim([-4 4]) ylabel(’y[n]’,’FontSize’,14,’FontName’,’Calibri’)
xlabel(’ny’,’FontSize’,14,’FontName’,’Calibri’)
ylabel(’y[n]’,’FontSize’,14,’FontName’,’Calibri’) ylim([-3 5])
ylim([-10 35]) set(gca,’xgrid’,’on’,’ygrid’,’on’)
set(gca,’xgrid’,’on’,’ygrid’,’on’) legend(’Discrete Sample’,’location’,’best’)
legend(’discrete sample’,’location’,’northwest’)
print(’dsp_exp2_classtask_2.jpeg’,’-djpeg’,’-r314’) print(’dsp_exp2_classtask_3.jpeg’,’-djpeg’,’-r314’)

VOLUME 11, 2023 3


2) Graph 2) Graph

FIGURE 3. Graphical representation of y[n] = x[-2n+1] FIGURE 4. Graphical representation of y[n] = x[-n/2+3]

E. CODE AND GRAPH OF Y[N]=X[-N/2+3]

1) Code F. CODE AND GRAPH OF Y[N] = X[-2N+1]*X[N]

clc 1) Code
close all
clc
clear all
close all
x = [-2 1 4 3]
clear all
n = -2:1; x = [-2 1 4 3];
x1 = upsample(x,2);
n = -2:1;
n1 = []; x1 = downsample(x,2);
delta = n(2)-n(1);
n1=n;
for i = 1:length(n)
[x2 n2] = sigfold(x1,n1);
n1 = [n1,n(i),n(i)+delta/2]
[x3 n3] = sigshift(x2,n2,1);
end
n1 = n1(1:end) [y ny] = conv_sig(x3,n3,x,n)
[y ny] = sigshift(x1,n1,3) stem(ny,y,’filled’,’square’,’MarkerSize’,8)
stem(ny,y,’filled’) title(’Discrete plot of y[n] = x[-2n+1]*x[n]’,’FontSize’,20);
title(’Discrete plot of y[n] = x[-n/2+3]’); xlim([-3 3])
xlim([0 6]) xlabel(’ny’,’FontSize’,14,’FontName’,’Calibri’)
xlabel(’ny’,’FontSize’,14,’FontName’,’Calibri’) ylabel(’y[n]’,’FontSize’,14,’FontName’,’Calibri’)
ylabel(’y[n]’,’FontSize’,14,’FontName’,’Calibri’)
ylim([-10 15])
ylim([-3 5])
set(gca,’xgrid’,’on’,’ygrid’,’on’) set(gca,’xgrid’,’on’,’ygrid’,’on’)
legend(’Discrete Sample’,’location’,’northeast’) legend(’Discrete Sample’,’location’,’northeast’)
print(’dsp_exp2_classtask_4.jpeg’,’-djpeg’,’-r314’) print(’dsp_exp2_classtask_5.jpeg’,’-djpeg’,’-r314’)
grid on

4 VOLUME 11, 2023


2) Graph OMAR ABDULLAH pursuing B.Sc(Engg.) in
electrical and electronic engineering from Chit-
tagong University of Enginnering and Technol-
ogy,Chattogram,Bangladesh
Enthusiastic and motivated electrical engineering
undergraduate student with a strong passion for
innovation and technology. Skilled in circuit de-
sign, programming languages, and proper idea in
MATLAB. Seeking research internship or co-op
opportunities to further develop skills and con-
tribute to cutting-edge projects. Eager to apply theoretical knowledge in a
practical setting and make a positive impact in the field of power electronic

FIGURE 5. Graphical representation of y[n] = x[-2n+1]*x[n]

III. DISCUSSION
Time-shifting, signal folding, and signal addition are only a
few of the essential discrete-time signal processing processes
that we have seen in detail. The convolution sum, a basic pro-
cess obtained by combining time-shifting and signal folding,
is the main emphasis. The paper lays forth the mathematical
underpinnings of convolution and illustrates its importance in
a variety of applications, including filtering, system analysis,
and image processing. The work includes a practical compo-
nent utilizing MATLAB, a potent signal-processing tool, in
recognition of the significance of practical implementation.
Readers are led through the efficient use of convolution in
MATLAB through instructive examples and code snippets,
improving their comprehension of the theoretical and prac-
tical facets of this essential discrete-time signal processing
procedure.

REFERENCES
[1] Alan V Oppenheim. Discrete-time signal processing. Pearson Education
India, 1999.
[2] John G Proakis. Digital signal processing: principles, algorithms, and
applications, 4/E. Pearson Education India, 2007.

VOLUME 11, 2023 5

You might also like