Professional Documents
Culture Documents
Convolution Integral
Convolution Integral
Convolution Integral
10
5
Temp ( o C)
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 1 of 26
4/18/23, 00:14
Temp (
-5
3
h(t)
0 2 4 6 8 10 12 14 16 18 20 22 24
t (days)
You can change the "width" of the function by adjusting τ (time constant for
exponential, or window width for moving average).
τ
0.8 (days) 0.2 8
Note: the height changes as well as the width because the area of the weighting function must equal 1
(see below for explanation if you are interested).
10
5
C)
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 2 of 26
4/18/23, 00:14
f(λ) (0C)
0
-5
-10
-15
0 2 4 6 8 10 12 14 16 18 20 22 24
λ (days)
The blue function to the right is the external temperature. The red (transparent)
function indicates how the weighting function contributes at a time, "t". The
weighting function is shown for reference only, the actual height is shown on the
previous graph. You can also click in any of the bottom three graphs to set the value
of "t".
t
0 (days) 0 24
As an example try setting the time "t" to 8 days. The graph now shows the
weighting function, reversed, and shifted over to t=8 seconds. The product is shown
in magenta in the graph below that one (labelled "f(λ)·h(t-λ) vs λ"). The integral of
the magenta line is the weighted average. You can see that, for exponential
weighting, the points in the recent past have are accentuated while those further in
the past are attenuated. Thus the points from the recent past contribute more to the
integral.
f(λ)·h(t-λ) vs λ
20
10
f(λ·h(t-λ)
-10
-20
0 2 4 6 8 10 12 14 16 18 20 22 24
t (days)
10
Temps (0C)
-5
-10
-15
0 2 4 6 8 10 12 14 16 18 20 22 24
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 3 of 26
4/18/23, 00:14
0 2 4 6 8 10 12 14 16 18 20 22 24
Ext T Int T Calc T t t (days)
The very bottom graph shows the external temperature (blue), the calculated
internal temperature (i.e., the weighted average of the external temperature, and is
shown in purple), and the measured internal temperature is shown in green. The
weighted average is calculated as
+∞
y(t) = ∫ h(t − λ) ⋅ f(λ) ⋅ dλ
−∞
In this equation, f(t) is the internal temperature, h(t) is the weighting function, and
y(t) is the weighted average. Note that the variable λ is just a dummy variable for
integration and does not appear in the final result.
Things to try
Increase the width of the weighting function (i.e., increase τ). Note that the
calculated temperature gets smoother because the "average" is over a longer time
period.
Decrease the width of the weighting function (i.e., decrease τ). Note that the
calculated temperature gets closer to the external temperature because the
"average" is over a shorter time period.
Try setting t=8 days, τ=4 days. The calculated internal temperature (i.e., the
weighted average) is above 0° because the temperature in the recen past was
mostly above 0°.
Try setting t=18 days, τ=4 days. The calculate internal temperature (i.e., the
weighted average) is below 0° because the temperature in the recent past was
below above 0°.
Try setting τ=1.5 days. The calculated internal and external temperature are almost
equal after an initial startup transient (see below for explanation if you are interested).
Convolution is a very powerful technique that can be used to calculate the zero
state response (i.e., the response to an input when the system has zero initial
conditions) of a system to an arbitrary input by using the impulse response of a
system. It uses the power of linearity and superposition. To understand the power
that this technique gives, consider the system described by the differential equation:
You know how to find the output y(t) if the input f(t) is a well defined input such as a
step, impulse or sinusoid. Convolution allows you to determine the response to
more complex inputs like the one shown below. In fact, you can use convolution to
find the output for any input, if you know the impulse response. This gives
incredible power.
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 5 of 26
4/18/23, 00:14
There are several ways to understand how convolution works. First convolution
will be developed in an approximate form as the sum of impulse responses. This
presentation is useful for an intuitive understanding of the convolution process.
After the approximate form is developed, the exact analytic form of convolution is
given. You can also link to an example of the convolution integral in action, and to a
less physical (more mathematical) derivation.
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 6 of 26
4/18/23, 00:14
The approximation can be taken a step further by replacing each rectangular block
by an impulse as shown below. The area of each impulse is the same as the area
of the corresponding rectangular block. (Since the width of the block was 0.8, each
impulse falls slightly below the function).
The superposition theorem states that the response of the system to the string of
impulses is just the sum of the response to the individual impulses. The response of
the system to the individual impulses is shown below.
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 7 of 26
4/18/23, 00:14
In this equation
y(t) is the output
i·ΔT is the time delay of each impulse
(f(i·ΔT)·ΔT) is the area of the ith impulse
if you take the limit as ΔT→0, the summation yields the convolution integral
(with i·ΔT=λ, ΔT=dλ)
For our purposes the two integrals are equivalent because f(λ)=0 for λ<0, h(t-
λ)=0 for t>xxlambda;.
The arguments in the integral can also be switched to give two equivalent
forms of the convolution integral
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 8 of 26
4/18/23, 00:14
This equation merely states that the output is equal to the sum of the responses
from the individual impulses. Another (more mathematical) derivation of the
convolution integral is given here.
The summed response is shown in the graph below, along with the individual
responses.
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 9 of 26
4/18/23, 00:14
The graph below shows our approximate response, for ΔT=0.8 and ΔT=0.3,
along with the exact response (the "exact" response is actually a numerical
approximation, as calculated by Matlab).
The graph below shows the "exact" response along with the response calculated
using Matlab "conv" (convolve) function. Type "help conv" at the Matlab prompt to
see how it works. Examine the script, convolution.m, which generated all these
graphs for an example of how to use the function.
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 10 of 26
4/18/23, 00:14
Hopefully this background gives you some physical insight into how convolution
can be used to find the response of the system to an arbitrary input.
Convolution can be used to calculate the zero state response (i.e., the
response to an input when the system has zero initial conditions) of a system
to an arbitrary input by using the impulse response of a system. Given a
system impulse response, h(t), and the input, f(t), the output, y(t) is the
convolution of h(t) and f(t):
If h(t)=0 for t<0 and f(t)=0 for t<0 we can change the limits of integration such
that:
y (t) = ∫ f (λ) h (t − λ) dλ
−∞
or equivalently
t
y (t) = ∫ f (λ) h (t − λ) dλ
0
Consider the system discussed previously with the impulse response described
by:
4 3
h (t) = √ e−0.5t sin(√ t), t⩾0
3 4
as shown below
To find the response of the system, y(t), to an input, f(t), at t=1 sec we need to
evaluate the integral
t
y (t) = ∫ f (λ) h (t − λ) dλ
0
with t=1. To visualize this process consider the product f(λ)h(t-λ). A plot of f(λ)
yields the input. A plot of h(t-λ) yields a time-reversed version of the impulse
response with a time delay of t (1 second in this case). These are shown below
along with the product of the two functions (solid black line). The function h(t-λ) is
plotted in magenta and doesn't look much like the function above -- but note the
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 12 of 26
4/18/23, 00:14
plotted in magenta and doesn't look much like the function above -- but note the
different vertical scales.
The next graph shows the result of the integration for all time, with a black dot at
t=1.
As t is increased further the function h(t-λ) shifts to the right. The multiplication and
integration can be evaluated for each value of t to yield the system response y(t).
The graphs below are similar to the ones above, except that t=4.
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 13 of 26
4/18/23, 00:14
Top graph: Two functions, h(t) (dashed red line) and f(t) (solid blue line) are plotted
in the topmost graph. As you choose new functions, these graphs will be updated.
Middle graph: The middle graph shows three separate functions and has an
independent variable (i.e., x-axis) of λ. This is important - in this graph λ varies and t
is constant. Shown are
f(λ) (solid blue line). Note: this looks just like f(t).
h(t-λ) (dashed red line). Note: this is reversed horizontally relative to the original
(because of the minus sign on the independent variable, i.e., -λ) and shifted
horizontally (by the an amount equal to the constant t).
the product, f(λ)·h(t-λ) (pink line, and filled in with pink). Note: this is a function of λ,
with t being a constant). This function is shaded in pink as a reminder that the
convolution is the integral of this function for this particular value of t. (i.e., the
shaded area above 0 minus the shaded area below zero).
the value of "t". You can change the value of t by clicking and dragging within
the middle or bottom graph.
The variable λ does not appear in the final convolution, it is merely a dummy
variable used in the convolution integral (see below).
Bottom graph: The bottom graph shows y(t), the convolution of h(t) and f(t),
as well as the value of "t" specified in the middle graph (you can change the value of
t by clicking and dragging within the middle or bottome graph).
+∞ t
y(t) = ∫ h(t − λ) ⋅ f(λ) ⋅ dλ = ∫ h(t − λ) ⋅ f(λ) ⋅ dλ
−
−∞ 0
Click here to see why the two integrals are equal despite the different limits of integration.
2 h(t)
h(t), f(t)
f(t)
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 14 of 26
4/18/23, 00:14
-1
-1 0 1 2 3 4 5
t
3
h(t-λ), f(λ), h(t-λ)·f(λ)
2 h(t-λ)
f(λ)
h(t-λ)·f(λ)
1 t
-1
-1 0 1 2 3 4 5
λ
1
y(t)
t
y(t)
Convolution is a powerful tool for determining the output of a system to any input.
The Convolution Theorem is developed here in a completely mathematical way. On
this page we will derive the convolution theorem: If the input to a system is x(t), and
the impulse response of that system is h(t), then we can determine the output of the
system, y(t), from the integral:
t
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html ∫ Page 15 of 26
4/18/23, 00:14
t
y (t) = ∫ h (t − λ) f (λ) dλ
0
Start with a linear time-invariant (LTI) system (in box). There is an input to the
system, x(t), and an output from the system, y(t).
Now consider the same system with the input as an impulse, δ(t). The output is
then, by definition, the impulse response, h(t).
If we use a delayed impulse into the system, the output is just the impulse response
with the same delay.
Because of linearity, if we scale the input by any factor, the output will be scaled by
the same factor. In particular, we can scale the input (and hence the output) by the
factor x(λ)dλ.
If we integrate the input, the output is also integrated. In this case we'll take the
upper limit of the integration to be t+; but it could just as well have been positive
infinity. We could also take the lower lower limit to be negative infinity.
By the sifting property of the impulse function we know that (if λ>0, t>0):
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 16 of 26
4/18/23, 00:14
By the sifting property of the impulse function we know that (if λ>0, t>0):
t
∫ δ (t − λ) x (λ) dλ = x (t)
0
If the input is x(t), then the output must be y(t) (by definition, from the first diagram).
Contents
Introduction
Review: Convolution as sum of impulse responses
In Depth Example (rectangular pulse and exponential)
Brief Examples - how to determine integration limits
Introduction
This page goes through an example that describes how to evaluate the
convolution integral for a piecewise function. The key idea is to split the integral up
into distinct regions where the integral can be evaluated. This is done in detail for
the convolution of a rectangular pulse and exponential. This is followed by several
examples that describe how to determine the limits of integrations that need to be
used when convolving piecewise functions.
In this web page we will use the system described by the differential equation:
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 17 of 26
4/18/23, 00:14
which has an impulse response given by a causal exponential (i.e., h(t) is assumed
to be zero for t<0), shown as a red dashed line. We will use convolution to find the
zero input response of this system to the input given by a rectangular pulse, which
we define piecewise by three distinction sections, and shown as a blue line.
h(t), f(t)
⎧
⎪ 0, t < 0 (sec tion 1)
f (t) = ⎨ 1, 0 ≤ t ≤ 2 (sec tion 2)
0
⎩
⎪
0, 2 < t (sec tion 3)
-1
-1 0 1 2 3
t
The next section reiterates the development of the page deriving the convolution
integral. If you feel you know that material, you can skip ahead to the mechanics of
using the convolution integral.
Note the first and last impulses are smaller because they include
the parts
of f(t) that are zero before the pulse (t<0) and after the pulse (t>2).
0
-1 0 1 2
t
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 18 of 26
4/18/23, 00:14
⎧
⎪ 0, t < 0 (sec tion 1)
f(t) = ⎨ 1, 0 ≤ t ≤ 1 (sec tion 2)
⎩
⎪
0, 1 < t (sec tion 3)
+∞
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html ∫ Page 19 of 26
4/18/23, 00:14
Because the input function has three distinct regions t<0, 0<t<1 and 1<t, we will
need to split up the integral into three parts.
Section 1: t<0
For t<0 the argument of the impulse function (t-λ) is always negative. Since h(t-
λ)=0 for (t-λ)<0, the result of the integral is zero for t<0.
1
h(t-λ)
f(λ)
h(t-λ)·f(λ)
0 t
-1
-1 0 1 2 3 4 5
λ
The result for the first part of our solution is the integral of the magenta line (this is
the product, which is always zero),
y(t) = 0, t<0
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 20 of 26
4/18/23, 00:14
1
h(t-λ)
f(λ)
h(t-λ)·f(λ)
0 t
-1
-1 0 1 2 3 4 5
λ
+∞
1
= e−2t ( (e2t − 1))
2
1
= (1 − e−2t )
2
Thus, the result for the second part of the solution is
1
y(t) = (1 − e−2t ) , 0≤t≤1
2
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 21 of 26
4/18/23, 00:14
1
h(t-λ)
f(λ)
h(t-λ)·f(λ)
0 t
-1
-1 0 1 2 3 4 5
λ
+∞
1 1
= e−2t ( (e2 − 1)) = e−2(t−1) ( (1 − e−2 ))
2 2
Thus, the result for the third part of the solution is:
1
y(t) = e−2(t−1) ( (1 − e−2 )) , 1<t
2
⎧
⎪
0, t<0
y (t) = ⎨ 2 (1 − e ) ,
1 −2t
0≤t≤1
⎪
⎩ e−2(t−1) ( 1 (1 − e−2 )) ,
2
1<t
-1
-1 0 1 2 3 4 5
t
This problem is solved elsewhere using the Laplace Transform (which is a much simpler technique,
computationally).
Examples
When the functions f(t) and/or h(t) are defined in a piecewise manner it is often
difficult to determine the limits of integration. To develop your ability to do this
several examples are given below, each with a different number of "regions" for the
convolution integral. The integrals are not actually performed, only the limits of
integration for each region are given. To determine the integral you need only
substitue in f(λ) and h(t-λ). In all cases there is a trivial region, t<0, where
t
∫−∞ f (λ) h (t − λ) dλ = 0. Click on any of the examples below (the text at the
left side of the page) to show or hide it. Each of the examples also has a link to an
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 23 of 26
4/18/23, 00:14
left side of the page) to show or hide it. Each of the examples also has a link to an
interactive demo which will allow you to vary t as well as to see the output of the
convolution.
Region
1, t<0 Trivial, not shown
t
∫−∞ =0
3
h(t-λ), f(λ), h(t-λ)·f(λ)
Region 2 h(t-λ)
2, t≥0 f(λ)
h(t-λ)·f(λ)
∫0t 1
t
To see how much easier this is than performing the integral in the time domain
consider the convolution integral from the previous page.
Note: This problem is solved on the previous page in the time domain (using the convolution
integral). If you examine both techniques, you can see that the Laplace domain solution is much
easier.
Solution:
To evaluate the convolution integral we will use the convolution property of the
Laplace Transform:
We need the Laplace Transforms of f(t) and h(t), but we can look them up in the
tables:
So
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 25 of 26
4/18/23, 00:14
References
© Copyright 2005-2013 Erik Cheever This page may be freely used for educational purposes.
Erik Cheever Department of Engineering Swarthmore College
References
© Copyright 2005 to 2014 Erik Cheever This page may be freely used for educational purposes.
Erik Cheever Department of Engineering Swarthmore College
https://lpsa.swarthmore.edu/Convolution/ConvolvePrint.html Page 26 of 26