In this digital signal processing and control engineering tutorial, we provide a clear and graphical explanation of the convolution operator which is also known as the convolution sum or simply as convolution. Signal convolution is a fundamental operation in signal processing, control theory, machine learning, and time series prediction. Consequently, it is of paramount importance to understand the mechanism behind signal convolution and to properly understand how to compute signal convolution in MATLAB. All this is explained in this tutorial. The YouTube page accompanying this tutorial is given below.
Definition of Convolution Sum Operator
Let
(1)
where
(2)
In the theory of discrete dynamical systems, the signal
In many cases, the signal
(3)
Let us write this sum until the term
(4)
The best approach for understanding convolution is to consider an example. Consequently, let us consider the following example.
Example demonstrating convolution: Let the signals
(5)
(6)
Compute the convolution sum
(7)
and give a graphical interpretation and derive a graphical method for computing the convolution sum.
Solution:
The figure below shows a graphical representation of two signals
First, taking into account that
(8)
Now, taking into account that
(9)
Let us now represent this sum for different values of
(10)
For
(11)
For
(12)
For
(13)
For
(14)
To give a graphical interpretation of the convolution sum, let us analyze again the derived equations
(15)
We can observe the following
- In the sum terms, the position of the sequence
stays the same as is increased. - In the sum terms, the sequence
is shifted in time at corresponding positions in the sum.
This means that in the graphical interpretation of the convolution sum, the sequence
(16)
From this formula, we have
(17)
In these sums, we can think of the sequence
Let us further elaborate on how the sequence
(18)
Taking into account the definition of the sequence
(19)
This is actually the original sequence
If we delay or shift this sequence in time, we will obtain the following sequences for different values of the time delay:
These shifted or delayed sequences constructed on the basis of
Let us start with
(20)
This sum has the graphical interpretation given in the figure below.
We only multiply the terms of the sequences
For
(21)
This sum has the graphical interpretation given in the figure below.
We delay the sequence
For
(22)
This sum has the graphical interpretation given in the figure below.
We delay the sequence
For
(23)
This sum has the graphical interpretation given in the figure below.
We delay the sequence
For
(24)
This sum has the graphical interpretation given in the figure below.
We delay the sequence
Convolution in MATLAB
The following MATLAB script will compute convolution
x = [1 2 3];
h = [3 2 1];
y = conv(x,h,'full')
The output is
y =
3 8 14 8 3
We used the MATLAB function conv() to compute the convolution. The MATLAB script is self-explanatory.