You are on page 1of 12

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/323237092

Chapter 5: Convolution

Chapter · January 2017

CITATIONS READS
0 1,211

1 author:

Ronald Pascual
De La Salle University
24 PUBLICATIONS   12 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Automated Reading Tutor for Filipino View project

Digital Signal Processing Laboratory Manual View project

All content following this page was uploaded by Ronald Pascual on 17 February 2018.

The user has requested enhancement of the downloaded file.


Convolution

5.1 Program Outcomes (POs) Addressed by the Activity


a. Ability to apply knowledge of mathematics and science to solve engineering problems
b. Ability to identify, formulate, and solve engineering problems
c. Ability to use techniques, skills, and modern engineering tools necessary for engineering
practice

5.2 Activity’s Intended Learning Outcomes


a. Write MATLAB program that compute the convolution of input sequences
b. Perform convolution of discrete-time sequences
c. Demonstrate verification of properties of convolution

5.3 Background
Convolution is one of the four most important DSP operations, the other three being correlation,
discrete transforms, and digital filtering. Convolution allows us to compute the output signal y(n) of a
linear time-invariant (LTI) system, given its input signal x(n) and its impulse response h(n) as the system
model. This is diagrammatically illustrated in Fig. 5.1 below. We will see later in this course that the
digital filters that we would design are represented as LTI systems.

input signal output signal


LTI System
x(n) h(n) y(n) = x(n)⊛h(n)

Fig. 5.1. Representation of LTI system

The convolution y(n) of two sequences h(n) and x(n) is given by the following:

M 1
y(n)   h(k )  x(n  k ), for n 0,1,2,...( M  1)
k 0

where M=N1+N2-1, N1=length of sequence 1, and N2=length of sequence 2.

Important properties of convolution include identity, delay, commutative, associative, and


distributive properties. These properties of convolution are listed in Table 5.1 below for your reference.

DSP Lab Manual – Ronald M. Pascual & FEU Institute of Technology Page 57
Table 5.1. Properties of Convolution

PROPERTY EQUATION
Identity x(n) ⊛ δ(n) = x(n)
Delay x(n) ⊛ δ(n−n0) = x(n−n0)
Commutative x(n) ⊛ h(n) = h(n) ⊛ x(n)
Associative {x(n) ⊛ h1(n)} ⊛ h2(n) = x(n) ⊛ {h1(n) ⊛ h2(n)}
Distributive x(n) ⊛ {h1(n) + h2(n)} = x(n) ⊛ h1(n) + x(n) ⊛ h2(n)

5.4 Computation of Convolution


In MATLAB, the easiest way to compute the convolution of two sequences is simply to call the built-in
function ‘conv’. The syntax for the ‘conv’ command is:

y = conv (x, h)

where ‘x’ and ‘h’ are input sequences or vectors.

Example 5.1
Suppose we want to compute the convolution of the following sequences:

x(n) = [ 1, 2, 3, 4, 5 ]

h(n) = * −0.5, 1, −0.2 +

In MATLAB Command Window, the commands, and MATLAB’s response for the desired computation
are:

>> x=[1,2,3,4,5];h=[-0.5,1,-0.2];
>> y=conv(x,h)
y =
-0.5000 0 0.3000 0.6000 0.9000 4.2000 -1.0000

Convolution computation using the ‘conv’ command may also be interpreted as the polynomial
multiplication of the two input vectors representing their respective polynomial coefficients.

DSP Lab Manual – Ronald M. Pascual & FEU Institute of Technology Page 58
Say for example that we have a 6-point sequence x(n) and a 3-point sequence h(n). The convolution of
x(n) and h(n) may also be expressed as a matrix multiplication shown below:

In the above matrix multiplication equation, the matrix made up of the samples of x(n) is also called
the Toeplitz matrix. In MATLAB, the command ‘toeplitz(C,R)’, where ‘C’ is the first column and ‘R’
is the first row, generates the desired Toeplitz matrix.

Example 5.2
Without using the ‘conv’ command in MATLAB, we will now write our own convolution M-file function
that employs matrix multiplication involving a Toeplitz matrix. To accomplish the task, we may construct
the MATLAB program ‘func_5_1.m’ given below in Fig. 5.2.

Fig. 5.2. The function ‘func_5_1.m’ for Example 5.2.

To test our M-file function, we can type the following commands, and check MATLAB’s response, in the
MATLAB Command Window:

>> x=[1,2,3,4,5];h=[-0.5,1,-0.2];
>> y=func_5_1(x,h)
y =
-0.5000 0 0.3000 0.6000 0.9000 4.2000 -1.0000

Observe from the above interaction that we get exactly the same response as with Example 5.1.

DSP Lab Manual – Ronald M. Pascual & FEU Institute of Technology Page 59
Exercise 5.1
It may easily be verified that the convolution of a 6-point sequence x(n) and a 3-point sequence h(n) can
be expressed as a vector combination given below:

Without using the ‘conv’ and the ‘toeplitz’ commands in MATLAB, write your own convolution M-file
function that employs the vector combination process given above. Save your work as ‘exer_5_1.m’. List
down the commands you employed in your function in the space provided below:

QUESTION 5.1:
What is the output that your function returns given the inputs x(n) = [ 1, 2, 3, 4, 5 ] and
h(n) = * −0.5, 1, −0.2 +?

DSP Lab Manual – Ronald M. Pascual & FEU Institute of Technology Page 60
5.5 Convolution and Its Properties
Earlier in this chapter, some important properties of convolution have been presented in Table 5.1. We
will now verify some of these properties by computing the convolution of some discrete-time signals.

Example 5.3
Consider the following discrete-time signals:

1
x(n)  5 sin[2 ( )n], for n  0,1,2,..., 74
30
h(n)   (n  15), for n  0,1,2,..., 74

Say we want to compute the convolution y(n) = h(n) ⊛ x(n), and then make subplots of the signals, x(n),
h(n) and y(n). The MATLAB program ‘script_5_1.m’ presented below in Fig. 5.3 can do the desired task.

Fig. 5.3. The M-file ‘script_5_1.m’ for Example 5.3.

Running ‘script_5_1.m’ would produce the signal subplots shown in Fig. 5.4 below. Observe that the
signal h(n) is a shifted delta function, the delay being equal to 15 time units. Observe also that the
convolution signal y(n) is just a delayed version of the signal x(n). Thus, this example allows us to verify
the delay property of convolution as given in the second entry of Table 5.1. That is,

x(n) ⊛ δ(n−n0) = x(n−n0).

DSP Lab Manual – Ronald M. Pascual & FEU Institute of Technology Page 61
Fig. 5.4. The output subplots produced by ‘script_5_1.m’.

Example 5.4
Again consider the signals x(n) and h(n) from Example 5.3. Let us now verify the commutative property
of convolution by computing and plotting the results of the following convolution equations:

M 1
y1 (n)   h(k )  x(n  k ), for n 0,1,2,...( M  1)
k 0

M 1
y2 (n)   x(k )  h(n  k ), for n 0,1,2,...( M  1)
k 0

To accomplish the task, we can construct the M-file ‘script_5_2.m’ shown below in Fig. 5.5. From
line 5 to line 6 of ‘script_5_2.m’, observe how the order of the operands ‘x’ and ‘h’ have been switched.
This would constitute a test for commutativity. And the outputs ‘y1’ and ‘y2’, graphically presented in
the lower two plots of Fig. 5.6, being equal to each other indeed shows that convolution is commutative.

DSP Lab Manual – Ronald M. Pascual & FEU Institute of Technology Page 62
Fig. 5.5. The M-file ‘script_5_2.m’ for Example 5.4.

Fig. 5.6. The output subplots produced by ‘script_5_2.m’.

DSP Lab Manual – Ronald M. Pascual & FEU Institute of Technology Page 63
Exercise 5.2
Write an M-file script that generates/computes and subplots (into a 5-by-2 matrix of axes) the following
signals:

 x1(n) = 5u(n) − 3u(n−15), for n = 0 to 40;


 x2(n) = −ur(n−15), for n = 0 to 40;
 x3(n) = (0.95)n, for n = 0 to 40;
 y1(n) = x1(n)⊛x2(n)
 y2(n) = x1(n)⊛x3(n)
 y3(n) = x2(n)⊛x3(n)
 y4(n) = y1(n)⊛x3(n)
 y5(n) = x1(n)⊛y3(n)
 y6(n) = y1(n)+y2(n)
 y7(n) = x1(n)⊛[x2(n)+x3(n)]

Save your work as ‘exer_5_2.m’. List down your M-file commands in the space provided below.

DSP Lab Manual – Ronald M. Pascual & FEU Institute of Technology Page 64
QUESTION 5.2:
Which among the signals y1(n) through y7(n) are the same? Explain their equality by properly citing an
associated property of convolution.

*** Machine Problem


The Lab Instructor provides the machine problem for this chapter.

DSP Lab Manual – Ronald M. Pascual & FEU Institute of Technology Page 65
MATLAB Code/Notes:
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________

DSP Lab Manual – Ronald M. Pascual & FEU Institute of Technology Page 66
Results and Conclusion:
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________

DSP Lab Manual – Ronald M. Pascual & FEU Institute of Technology Page 67

View publication stats

You might also like