0% found this document useful (0 votes)
1 views

Lab 5 Final

Lab 5

Uploaded by

mujtabajamal2004
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Lab 5 Final

Lab 5

Uploaded by

mujtabajamal2004
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Department of Computer Engineering

Digital Signal Processing

Course Instructor:

Lab Engineer:

Semester
LAB EXPERIMENT # 05

Implementation of Convolution & Properties of Convolution in MATLAB

OBJECTIVE:

To Represent the Convolution & Properties of Convolution in MATLAB.

CONVOLUTION OF SIGNALS:

In mathematics and functional analysis, convolution is a mathematical operation on two functions


f and g, producing a third function that is typically viewed as a modified version of one of the
original functions, giving the area overlap between the two functions as a function of the amount
that one of the original functions is translated. Convolution is similar to cross-correlation. It has
applications that include probability, statistics, computer vision, image and signal processing,
electrical engineering, and differential equations.

The convolution of f and g is written f g. It is defined as the integral of the product of the two
functions after one is reversed and shifted. As such, it is a particular kind of integral transform:

For complex-valued functions f, g defined on the set Z of integers, the discrete convolution of f and
g is given by:

PROPERTIES OF CONVOLUTION OF SIGNALS:

The convolution of f and g is written f g. It is defined as the integral of the product of the two
functions after one is reversed and shifted. As such, it is a particular kind of integral transform:
For complex-valued functions f, g defined on the set Z of integers, the discrete convolution of f and
g is given by:

The convolution defines a product on the linear space of integrable functions. This product satisfies
the following algebraic properties, which formally mean that the space of integrable functions with
the product given by convolution is a commutative algebra without identity. Other linear spaces of
functions, such as the space of continuous functions of compact support, are closed under the
convolution, and so also form commutative algebras.

▪ Commutative:

▪ Associative:

▪ Distributive:

▪ Associativity with scalar multiplication:

For any real (or complex) number .

MATLAB CODE FOR IMPLEMENTATION:

1. Convolution implementation.

MATLAB CODE OUTPUT


%% Graphical Convolution Method
Plot Graphic
Convoluti
MethoPlo
3 al on d t
0
x=[2 4 6]; h=[1 1
1]; y=conv(x,h); 2
0
stem(y,'k'); grid on;
xlabel('Time'); 1
ylabel('Amplitude'); title('Graphical 0
Convolution Method Plot'); 0
axis([0 10 0 30]); 0 2 4 6 8 1
Time 0

2. Commutative property of Convolution implementation

MATLAB CODE OUTPUT


% Convolution Commutative
Property

%% x*h x=[1
2 3]; h=[1 1 1]; y1=conv(x,h);
subplot(2,1,1); stem(y1,'k');
xlabel('Index Number');
ylabel('Amplitude'); axis([0
10 0 10]);

%% h*x

y2=conv(h,x);
subplot(2,1,2);
stem(y2,'k'); xlabel('Index
Number'); ylabel('Amplitude');
axis([0 10 0 10]);

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

PRACTICE QUESTIONS

Q1. Proof the Commutative associative and distributive property for a system having input x[n]
=[ 1 -2 3 4 -3 -2 4] and impulse response h1=[3 2 1 2 2 1 -1] and h2=[-1 2 3 -2 -3 1 5].
Output:
CPEN221101023
Commutative Property Check:
Result of input * impulse_1:
3 -4 6 18 0 -5 16 13 -5 -3 9 6 -4
Result of impulse_1 * input:
3 -4 6 18 0 -5 16 13 -5 -3 9 6 -4
Are both results identical? 1
Associative Property Check:
Result of input * (impulse_1 * impulse_2):
-3 10 -5 -24 53 62 -69 -64 137 105 -109 -35 157 61 -79 -16 63 26 -20
Result of (input * impulse_1) * impulse_2:
-3 10 -5 -24 53 62 -69 -64 137 105 -109 -35 157 61 -79 -16 63 26 -20
Are both results identical? 1
Distributive Property Check:
Result of input * (impulse_1 + impulse_2):
2 0 2 12 21 4 -15 2 39 12 -20 0 16
Result of (input * impulse_1) + (input * impulse_2):
2 0 2 12 21 4 -15 2 39 12 -20 0 16
Are both results identical? 1
Q2. Write the Matlab code to draw the following signal and then convolve it with h2 mentioned
in question 1.

x[n]

0 2
n

-2
-4

Code: Output:

Rubrics:

Theoretical Setup Troubleshooting Completeness Total Aggregate


concepts preparation

You might also like