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 and
be two scalar discrete-time signals, and let
be a discrete-time instant. Then, convolution of
and
is defined as follows
(1)
where is another discrete-time signal that is determined by the convolution. Often in literature, the convolution (convolution sum operator) is denoted by the start operator “
“. Consequently, convolution can be written like this
(2)
In the theory of discrete dynamical systems, the signal is often the impulse response of a linear dynamical time-invariant system, and
is the discrete-time input signal. In that case, convolution (2) defines a response of the discrete-time system to the input
. That is, the response of the system is completely determined by the impulse response and the input signal. This is a very important fact in linear system theory.
In many cases, the signal is zero for negative values of
. In that case, we can expand the sum as follows
(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 and
be defined as follows
(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 for negative values of
, the sum (7) takes the following form
(8)
Now, taking into account that only for
, the convolution sum (8) takes the following form
(9)
Let us now represent this sum for different values of . For
, we have
(10)
For , we have
(11)
For , we have
(12)
For , we have
(13)
For , we have
(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 is fixed, and the sequence
is shifted. However, the sequence
has to be reversed or reflected with respect to the vertical axis. This is explained in the sequel. For that purpose, and for clarity, let us again write the general formula (9) as follows
(16)
From this formula, we have
(17)
In these sums, we can think of the sequence ,
, as the sequence
that is shifted (delayed) for
time steps.
Let us further elaborate on how the sequence is constructed from the sequence
or
. Let us denote the sequence
by
. That is,
(18)
Taking into account the definition of the sequence , for
, the sequence
is
(19)
This is actually the original sequence that is mirrored or reflected with respect to the vertical axis
. This sequence is illustrated in the figure below.

![Rendered by QuickLaTeX.com h[-k]](https://aleksandarhaber.com/wp-content/ql-cache/quicklatex.com-028d8cbe0e5a5bace50c828be29c8da0_l3.png)
If we delay or shift this sequence in time, we will obtain the following sequences for different values of the time delay:

![Rendered by QuickLaTeX.com h[-k]](https://aleksandarhaber.com/wp-content/ql-cache/quicklatex.com-028d8cbe0e5a5bace50c828be29c8da0_l3.png)




These shifted or delayed sequences constructed on the basis of , will help us to graphically interpret the convolution sum.
Let us start with
(20)
This sum has the graphical interpretation given in the figure below.

![Rendered by QuickLaTeX.com y[0]](https://aleksandarhaber.com/wp-content/ql-cache/quicklatex.com-303eaebff2cb2159ebc878229caa4eed_l3.png)
We only multiply the terms of the sequences and
that are in the dashed rectangle.
For , we have
(21)
This sum has the graphical interpretation given in the figure below.

![Rendered by QuickLaTeX.com y[1]](https://aleksandarhaber.com/wp-content/ql-cache/quicklatex.com-5c130d8a2453ab754d4f44b240ec527e_l3.png)
We delay the sequence to obtain
, and we only multiply the terms of the sequences
and
that are in the dashed rectangle.
For , we have
(22)
This sum has the graphical interpretation given in the figure below.

![Rendered by QuickLaTeX.com y[2]](https://aleksandarhaber.com/wp-content/ql-cache/quicklatex.com-80430bda773bf7cb6ca603292b7c979c_l3.png)
We delay the sequence to obtain
, and we only multiply the terms of the sequences
and
that are in the dashed rectangle.
For , we have
(23)
This sum has the graphical interpretation given in the figure below.

![Rendered by QuickLaTeX.com y[3]](https://aleksandarhaber.com/wp-content/ql-cache/quicklatex.com-0fa142f298bea8e6a16d4376658755a1_l3.png)
We delay the sequence to obtain
, and we only multiply the terms of the sequences
and
that are in the dashed rectangle.
For , we have
(24)
This sum has the graphical interpretation given in the figure below.

![Rendered by QuickLaTeX.com y[4]](https://aleksandarhaber.com/wp-content/ql-cache/quicklatex.com-58cd652f501eca4f303f36c7dbcec9c3_l3.png)
We delay the sequence to obtain
, and we only multiply the terms of the sequences
and
that are in the dashed rectangle.
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.