4
TIME DOMAIN REPRESENTATION OF LINEAR TIME-
INVARIANT SYSTEMS: CONVOLUTION
4.1 Introduction
Convolution is one of the major concepts of linear time-invariant system theory. Convolution relates an LTIs system's input to its
output thus it is a mathematical operation of fundamental importance in the theory of signals and systems. Convolution yields the
output of a relaxed (zero initial conditions) LTI system, given the input xn and the system's impulse response hn. A system's
impulse response is a unique property of the system that completely characterizes its dynamic behavior (under the assumption of
linearity). The impulse response, as the name suggests, is the output of a system given a unit impulse (sample) input.
4.2 Convolution integral
In an earlier chapter we presented methods of finding the impulse response of an LTI system. In this chapter we begin with a
known impulse response, denoted here ht, and we show that ht is sufficient to describe the system’s response to any input and
we derive the relationship between the input and output signals and the impulse response. Given an LTI system , the impulse
ht = dt
response of the system is the output to a unit impulse input.
(4.1)
For example, if the system is the RC filter, then it is well-known that the output voltage measured aross the capacitor resulting from
a unit impulse input at the source takes the form of a decaying exponential. The impulse response of an RC filter with R = C = 1
and zero initial conditions is therefore:
ht = ‰-t ut
xt in terms of the impulse function d t as follows.
Now consider an arbirtrary input xt. Using the sampling property of the impulse function we can write an integral expression for
xt =
¶
xt dt - t „ t (4.2)
-¶
The output of an LTI system to input xt will then be given by
yt = xt = xt dt - t „ t
¶
(4.3)
-¶
Using the fact that xt is independent of, or constant with respect to the system , we get
yt = xt dt - t „ t
¶
(4.4)
-¶
Now, from Eq. (1.1) and time-invariance we conclude that
yt =
¶
xt ht - t „ t (4.5)
-¶
2 Chapter04_Convolution.nb
This last result shows that the output of any LTI system may be obtained by evaluating the integral in Eq. (1.4) given an input and
the impulse response of the system. The integral in Eq. (1.5) is known as the convolution integral. Convolution is then the opera-
tion of computing this integral for two signal, the input signal xt and the impulse response signal ht. Convolution is frequently
denoted by the symbol * as in yt = xt * ht. Convolution is known to satisfy the commutative, associative, and distributive laws
of algebra therefore xt * ht = ht * xt and therefore the convolution integral may be written in the following two equivalent ways.
yt = xt ht - t „ t =
¶ ¶
ht xt - t „ t (4.6)
-¶ -¶
The output of an LTI system at time t is the area of the intersection of the input with a time shifted and reversed copy of the
impulse response (or vice versa). Clearly, evaluating thi integral may be difficult, unless the signals xt and ht are “nice”, simple
functions. The simplest possible convolution problem involves two signals that are ideal pulses. This problem can be easily solved
by hand calculation. Here I define signals xt and ht as pulses of width 2 and 1, respectively.
In[9]:= Clearx, h, y;
xt_ : Piecewise1, 0 t 2;
ht_ : Piecewise1, 0 t 1;
xt ht
1.0 1.0
0.8 0.8
0.6 0.6
0.4 0.4
0.2 0.2
-2 -1 1 2 3 4 -2 -1 1 2 3 4
It is typical to use a “divide-and-conquer” approach with the region of integration broken up into non-overlapping subregions. The
sum of the individual solutions in each of the subregions gives the total solution. The following plots will illustrate the mechanics of
evaluating equation (4.6).
This shows the shifted and reflected signal ht across the domain of the signal xt. In the first example, the two signals do not
overlap and therefore (1.6) evaluates to zero.
1.0
0.8
0.6
0.4
0.2
t
-4 -2 0 2 4
yt_ : 0 ; t 0
As the signal ht - t shifts to the right, it will begin to overlap signal xt. What is the value of t at which the two signals "touch"
each other?
Chapter04_Convolution.nb 3
The integral in the region of partial overlap is defined as follows
1
t
t
Therefore, we define the output signal as
yt_ : t ; 0 t 1
Continuing to shift to the right, signal ht enters a region in which it is completely overlapped by signal xt. Clearly, at this stage
the integral evaluates to a constant value of 1 (find the area inside the red rectangle).
Thus,
yt_ : 1 ; 1 t 2
Continuing, a partial overlap occurs involving the trailing edge of ht.
4 Chapter04_Convolution.nb
This yields the following integral
2
1
t1
3t
and
yt_ : 3 t ; 2 t 3
Finally, ht shifts beyond the leading edge of xt. Since the two signals do not overlap, the integral is again zero.
1.0
0.8
0.6
0.4
0.2
-2 -1 0 1 2 3 4
yt_ : 0 ; t 3
Having defined the output yt for all values of t, we plot the result.
Plotyt, t, 2, 6, Exclusions None, ImageSize Small
1.0
0.8
0.6
0.4
0.2
-2 2 4 6
The derivation shown above describes the traditional manual method of evaluating the convolution integral using paper-and-
pencil. Here, however, is the evaluation using Mathematica’s Integrate function.
Chapter04_Convolution.nb 5
In[16]:= Cleary;
yt_ : x ht ; yt OutputForm
Out[17]//OutputForm=
Piecewise[{{1, 1 < t <= 2}, {3 - t, 2 < t < 3}, {t, 0 < t <= 1}}]
Alternatively, the Convolve function may be used.
In[18]:= yt_ : Convolvex, h, , t; yt OutputForm
Out[18]//OutputForm=
Piecewise[{{1, 1 < t <= 2}, {3 - t, 2 < t < 3}, {t, 0 < t <= 1}}]
Finally, here is an interactive demonstration of the convolution operation on the two pulses defined in the preceding example.
Here is a demonstration showing the response of the RC circuit to a sinusoidal source. Recall that the impulse response of the RC
circuit, the voltage across the capacitor is a decaying exponential, ht = ‰-t ut.
1. Obtain the output of an LTI system defined by the impulse response ht = ‰-t ut to a pulse input of duration 2 seconds, starting at time
t = 0.
2. Obtain the output of an LTI system defined by the impulse response ht = ‰-t ut to the sinusoidal source xt = sint ut, as
Verify your result by comparing to the solution of the differential equation y ' t + yt == sint ut with zero initial condition (y0 = 0).
demonstrated above, by identifying the relevant solution regions, writing and solving the defining convolution integrals for each of them.
6 Chapter04_Convolution.nb
4.3 Convolution sum
The general one-dimensional linear convolution sum formula has the following two equivalent forms:
yn = hk xn - k = xk hn - k
¶ ¶
(4.7)
k=-¶ k=-¶
where hn is the so-called impulse response, xn the input and yn the output of a discrete-time LTI system. Convolution
satisfies the commutative, associative and distributive laws of algebra. These formulas can be easily derived. Consider an
arbitrary input signal as a superposition of scaled and shifted unit samples.
xn = ... + x-1 dn + 1 + x0 dn + x1 dn - 1 + x2 dn - 2 + ... = xk dn - k
¶
(4.8)
k=-¶
Now, the system response to a unit sample input is the sequence hn, namely, dn Ø hn. In a linear, time-invariant system, the
output of the system to input xn must be a superposition of the responses to each of the scaled and time-shifted impulses in
(2.2). We therefore get the following convolution formula.
yn = ... + x-1 hn + 1 + x0 hn + x1 hn - 1 + x2 hn - 2 + ... = xk hn - k
¶
(4.9)
k=-¶
As an example, consider the evaluation of the output of an LTI system with the impulse response and input shown below.
1, n = 0
hn = - 1, n = 1
0, otherwise
1, n = 0
2, n = 1, 2
xn =
-1, n = 3
0, otherwise
The output yn, by virtue of linearity and shift-invariance, is given by the following sum of scaled and shifted impulse responses.
yn = hn + 2 hn - 1 + 2 hn - 2 - hn - 3
Substitution of the algebraic formula for the impulse response yields the following summation.
dn -dn - 1
+
2 dn - 1 -2 dn - 2
yn = +
2 dn - 2 -2 dn - 3
+
- dn - 3 dn - 4
Simplifying, we get the following output signal.
yn = dn + dn - 1 - 3 dn - 3 + dn - 4
Here is an interactive presentation of the flip-and-slide method of evaluating a discrete-time convolution. Observe how the impulse
response h slides across the sequence of numbers x. At each position n the sum of products of the two sequences is shown
confirming the result previously derived using an algebraic approach.
Chapter04_Convolution.nb 7
0 1 2 2 1 0
1 1
1 1 0
3. Assume an LTI system with the following impulse response.
1
, n=0
hn = 1 , n = 1
2
2
0, otherwise
Determine the output of this system in response to the input
1, n = 0
xn =
2, n = 1, 2
-1, n = 3
0, otherwise
Here is a second example of convolving two numerical sequences using (1.7):
hn = un
2 n
3
and
xn =
1, 0§ n§ 9
0, else
This defines the two sequences.
In[21]:= Clearh, x
2 n
In[22]:= hn_ : UnitStepn;
3
xn_ : UnitStepn UnitStepn 10;
This example illustrate the so-called "flip-and-slide" operation which arises naturally as a consequence of formula (1.7). For each
value of n, the sum of the point-by-point products of the two sequences is evaluated yielding a single output value. When evalu-
ated for all values of n, we get the result shown below. An examination of the regions of support of the two sequences reveals that
there are three disjoint, but contiguous regions we need to consider when evaluating the convolution sum.
Region 1. For n < 0 there is no overlap between hm (blue) and xn - m (red).
n
8 Chapter04_Convolution.nb
So the result is
yn = 0, for n < 0
Region 2. For 0 § n < 9 there is a partial overlap between hm and xn - m.
Evaluating in Mathematica we get
hm OutputForm
n
In[24]:=
m0
Out[24]//OutputForm=
1 + n 1 + n
2 - 3
Piecewise[{{1, n == 0}}, -(---------------)]
--------------
n
3
Using a formula for the finite sum we get,
1-
nm=0 =3-2
2 n+1
2 m 2 n
yn = =
3
3 2 3
1-
3
Region 3. For n ¥ 9 we have full overlap between xm and hn - m.
The convolution sum now takes the form
hm Simplify
n
29n 3n 19 683 UnitStep 9 n
mn9
2 6561 UnitStep 8 n 4374 UnitStep 7 n 2916 UnitStep 6 n
1944 UnitStep 5 n 1296 UnitStep 4 n 864 UnitStep 3 n
576 UnitStep 2 n 384 UnitStep 1 n 256 UnitStepn
Chapter04_Convolution.nb 9
Using a formula for the finite sum we obtain the following result for n ¥ 9 :
-
yn = nm=n-9
2 n-9 2 n+1
2 m 58 025 2 n
= =
3 3
3 2 512 3
1-
3
Putting together the results for all three regions we get the following piecewise function:
, 0 n 9,
2 n 58 025 2 n
yn_ : Piecewise3 2 , n 9;
3 512 3
This shows the result.
This result can be confirmed by evaluating the convolution sum directly in Mathematica:
In[25]:= DiscreteConvolvexm, hm, m, n Simplify OutputForm
Out[25]//OutputForm=
-9 + n 1 + n
58025 2 2
Piecewise[{{-------------,
------------ n >= 10}}, 3 - ------]
-----
n n
3 3
Here is an interactive demonstration.
4. Repeat the convolution calculation for the sequences in (2.4) by flipping-and-sliding sequence hn.
FIR filters
An important category of discrete-time systems exhibits a finite impulse response (FIR), so hn has finite support. It is common to
define hn on the interval 0 § n § Lh - 1. Sequence hn is then called a causal FIR filter of length Lh . In practice, the sequence
xn is also finite in length, so that yn can be computed in finite time. Consider two sequences xn and hn, defined for positive
values of n only, of length Lx and Lh , respectively. Equation (1.7) then reduces to the following finite summation:
yn = hi xn - i
Lh -1
(4.10)
i=0
with the output sequence yn supported on the finite domain 0 § n < Lx + Lh - 1. It is instructive to evaluate the sum for all
values of n in this domain. Begin by defining the sequences and their lengths.
10 Chapter04_Convolution.nb
Clearx, h, y;
Lx 8; Lh 3;
xn_ : 0 ; n 0 n Lx ;
hn_ : 0 ; n 0 n Lh ;
Here is a Mathematica implementation of (1.10).
yn_ : hi xn i
Lh 1
i0
This shows the result.
Tablen, yn, n, 0, Lx Lh 2 TableForm
0 h0 x0
1 h1 x0 h0 x1
2 h2 x0 h1 x1 h0 x2
3 h2 x1 h1 x2 h0 x3
4 h2 x2 h1 x3 h0 x4
5 h2 x3 h1 x4 h0 x5
6 h2 x4 h1 x5 h0 x6
7 h2 x5 h1 x6 h0 x7
8 h2 x6 h1 x7
9 h2 x7
The output may be subdivided into three sections. The first and last Lh - 1 samples represent "transient" portions of the output
signal due to a partial overlap of nonzero values of hn and the reversed and shifted version of xn. The middle samples repre-
sent a "steady state" portion of the output sequence. This occurs whenever sequence hn and the reversed and shifted version
Tablen, yn, n, Lh 1, Lx 1 TableForm
of xn are fully overlapped.
2 h2 x0 h1 x1 h0 x2
3 h2 x1 h1 x2 h0 x3
4 h2 x2 h1 x3 h0 x4
5 h2 x3 h1 x4 h0 x5
6 h2 x4 h1 x5 h0 x6
7 h2 x5 h1 x6 h0 x7
Here is an interactive version of the result shown above.
0 0 x0 x1 x2 x3 x4 x5 x6 x7 0 0
h2 h1 h0
h2 x2 h1 x3 h0 x4
5. How many non-zero output values result from convolving sequences xn and hn in preceding example? How many multiplication and
addition operations are needed to obtain a single output value? All the output values?
Convolution sum: efficient evaluation
Convolution is such an important mathematical operator that most advanced computational systems available today have built-in
functions for computing the convolution of two finite-length numerical sequences. For example, the two sequences in Problem 1
can be represented by the following two lists of numbers.
Chapter04_Convolution.nb 11
x 1, 2, 2, 1; h 1, 1;
Clearx, h;
Now, use the built-in convolution operator ListConvolve to obtain the result. By default only the steady-state values are
returned.
ListConvolveh, x
1, 0, 3
This returns all the non-zero values assuming zero-padding on both ends of the given lists of numbers.
ListConvolveh, x, 1, 1, 0
1, 1, 0, 3, 1
Alternatively, explicit padding of the input list x may be used.
ListConvolveh, ArrayPadx, 1
1, 1, 0, 3, 1
Example
As an example, we use convolution to smooth a noisy data sequence. The data values are monthly S&P 500 composite index
data FinancialData"SP500", 1957, 2011, "Month"All, 2;
quotations for the period from 1957 to 2011. First we read and plot the data.
ListPlotdata, ImageSize Small
1500
1000
500
100 200 300 400 500 600
A popular method of smoothing noisy data is to "locally" average the data. Such an operation may be conveniently expressed by
the following formula:
xn - N + ... + xn - 1 + xn + xn + 1 + ... xn + N
1
yn = (4.11)
2N +1
The unit sample response of a filter that performs this averaging operation (such a filter is commonly called a moving-average
filter) is defined
hn =
1
, for - N § n § N
2 N+1 (4.12)
0, otherwise
6. Verify (1.12) by evaluating (1.11) for a unit sample input, namely, xn = dn.
Thus the operation of smoothing signal xn may be implemented by convolving with impulse response hn. Here we show the
fir Table1, 11 11.;
result of smoothing with an 11-point moving average filter. First we define hn as a list.
This gives output of the moving average filter using the built-in function ListConvolve.
smooth ListConvolvefir, data;
This plots the smoothed data. By default, Mathematica returns the steady-state values of the convolution sum.
12 Chapter04_Convolution.nb
ListPlotsmooth, ImageSize Small
1400
1200
1000
800
600
400
200
100 200 300 400 500 600
This returns both the steady-state and transient samples for different lengths of moving average filter given by the parameter n.
filter length, n
1400
1200
1000
800
600
400
200
0 100 200 300 400 500 600
7. Discuss how the number of steady-state and transient samples changes with length of moving average filter.
4.4 Convolution and the impulse response
The impulse response of a LTI system is the system output when the input is a unit impulse: if xt = dt then yt = ht. In this
case, the output is the impulse response of the filter. Here is a validation of this statement using equation (1.6),
y t = ht dt - t „ t =
¶ ¶
dt ht - t „ t = ht (4.13)
-¶ -¶
Equation (4.13) illustrates a fundamental property of the unit impulse, namely that it is an identity element of convolution. This
property also holds for discrete convolution.
yn = hi xn - i = hi dn - i = hn
¶ ¶
(4.14)
i=-¶ i=-¶
It is also of interest to obtain formulas for the step response of a system, given that its impulse response is known. In the case of
continuous-time systems we get
y t = ht ut - t „ t = ut ht - t „ t =
¶ ¶ ¶
ht - t „ t (4.15)
-¶ -¶ 0
We can now use the result derived in (1.15) to find the step response of a system with ht = ‰-t ut. We get the following well-
known result.
yt = ht - t „ t = = ‰-t-t ut - t „ t = ‰-t-t „ t = ‰-t ‰ t „ t = ‰-t ‰ t t0 = ‰-t ‰t - 1 = 1 - ‰-t .
¶ ¶ t t
0 0 0 0
This shows a graphical interpretation of the result derived in Equation (1.15). The impulse response ht = ‰-t ut is used.
Chapter04_Convolution.nb 13
8. Obtain the step response of a system with impulse response given by ht = 1 - t ut - ut - 1.
Following similar steps as in Equaton (1.15), here is the step response of a discrete-time system given its impulse (unit sample)
response.
yn = hi un - i = ui hn - i = hn - i
¶ ¶ ¶
(4.16)
i=-¶ i=-¶ i=0
Using (1.16) we now find the step response of a system with hn = un.
2 n
3
yn = hn - i = un - i =
¶ ¶ 2 n-i n 2 n-i 2 n n 3 i 2 n
= =3-2 .
i=0 i=0 3 i=0 3 3 i=0 2 3
4.5 Solutions