DSP Exp 2
DSP Exp 2
‘‘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. 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;
2) Graph
1) Code
FIGURE 3. Graphical representation of y[n] = x[-2n+1] FIGURE 4. Graphical representation of y[n] = x[-n/2+3]
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([-5 1])
xlim([-5.5 -1]) 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
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.