Contents
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:
\[\dot y(t) + y(t) = f(t)\]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\left( t \right) = e^{-t},\quad t\geq 0\] \[f\left( t \right) = \left\{ {\begin{array}{*{20}{l}} {0,}&{t < 0}&{(\sec tion\;1)} \\ {1,}&{0 \leq t \leq 2}&{(\sec tion\;2)} \\ {0,}&{2 < t}&{(\sec tion\;3)} \end{array}} \right.\] |
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.
For continuity with the page
deriving the convolution integral we can approximate the input by a series of impulses... 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). |
|
plot the response of the system to each of these impulses... | |
then plot the response as the sum of the individual responses (in magenta). \[y_{approx}(t) = \sum\limits_{i = 0}^\infty {\left( {f\left( {i \cdot \Delta T} \right) \cdot \Delta T} \right)} \cdot h\left( {t - i \cdot \Delta T} \right)\] The green line on the plot is the exact solution and is derived below. |
Now let's discuss how we can find an exact solution to this problem, which is not always straightforward with functions that are defined piecewise. To find the output of the system with impulse response
\[h(t) = {e^{ - 2t}},\quad t > 0\]to the input
\[f(t) = \left\{ {\begin{array}{*{20}{c}}we will use the convolution integral
\[y(t) = \int\limits_{ - \infty }^{ + \infty } {f(\lambda ) \cdot h(t - \lambda )d\lambda } \]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.
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.
This situation is depicted graphically below (t=-0.2):
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,\quad t < 0\]For 0<t<2 we need to evaluate the integral only from λ=0 to λ=t, since f(λ)=0 when λ<0, and h(t-λ)=0 when (t-λ)<0 (or, equivalently t<λ). So the integral becomes, in effect:
\[y(t) = \int\limits_0^t {f(\lambda ) \cdot h(t - \lambda )d\lambda } \]This situation is depicted graphically below (t=0.5):
We can now evaluate the integral of the magenta line:
\[\eqalign{ y(t) &= \int\limits_{ - \infty }^{ + \infty } {f(\lambda ) \cdot h(t - \lambda )d\lambda } \\ &= \int\limits_0^t {f(\lambda ) \cdot h(t - \lambda )d\lambda } = \int\limits_0^t {1 \cdot {e^{ - 2(t - \lambda )}}d\lambda } \\ &= {e^{ - 2t}}\int\limits_0^t {{e^{2\lambda }}d\lambda } = {e^{ - 2t}}\left( {\frac{1}{2}\left. {{e^{2t}}} \right|_0^t} \right) \\ &= {e^{ - 2t}}\left( {\frac{1}{2}\left( {{e^{2t}} - 1} \right)} \right) \\ &= \frac{1}{2}\left( {1 - {e^{ - 2t}}} \right)} \]Thus, the result for the second part of the solution is
\[y(t) = \frac{1}{2}\left( {1 - {e^{ - 2t}}} \right),\quad 0 \leq t \leq 1\]For 1<t we need to evaluate the integral only from λ=0 to λ=2, since f(λ)=0 when λ<0 and when λ>2. So the integral becomes, in effect:
\[y(t) = \int\limits_0^1 {f(\lambda ) \cdot h(t - \lambda )d\lambda } \]This situation is depicted graphically below (t=1.2):
We can now evaluate the integral:
\[\eqalign{ y(t) &= \int\limits_{ - \infty }^{ + \infty } {f(\lambda ) \cdot h(t - \lambda )d\lambda } \\ &= \int\limits_0^1 {f(\lambda ) \cdot h(t - \lambda )d\lambda } = \int\limits_0^1 {1 \cdot {e^{ - 2(t - \lambda )}}d\lambda } \\ &= {e^{ - 2t}}\int\limits_0^1 {{e^{2\lambda }}d\lambda } = {e^{ - 2t}}\left( {\frac{1}{2}\left. {{e^{2t}}} \right|_0^1} \right) \\ &= {e^{ - 2t}}\left( {\frac{1}{2}\left( {{e^2} - 1} \right)} \right) = {e^{ - 2\left( {t - 1} \right)}}\left( {\frac{1}{2}\left( {1 - {e^{ - 2}}} \right)} \right) } \]Thus, the result for the third part of the solution is:
\[y(t) = {e^{ - 2\left( {t - 1} \right)}}\left( {\frac{1}{2}\left( {1 - {e^{ - 2}}} \right)} \right),\quad 1 < t\]We can get the results for all time by combining the solutions from the three parts.
\[y\left( t \right) = \left\{ {\begin{array}{*{20}{l}}This result is shown below.
This problem is solved elsewhere using the Laplace Transform (which is a much simpler technique, computationally).
An interactive demonstration of the example above is available.
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 $\int_{ - \infty }^t {f\left( \lambda \right)h\left( {t - \lambda } \right)d\lambda } = 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 interactive demo which will allow you to vary t as well as to see the output of the convolution.
Convolution of two exponentials, $f(t)=e^{-t}, \quad h(t)=3\cdot e^{-3t}$.
Region / Integral |
Graph | Notes |
Region 1, t<0 $\int_{ - \infty }^t = 0$ |
Trivial, not shown | The integral is 0 because the product at λ=0 because the product (the integrand) is 0 if t<0. |
Region 2, t≥0 $\int_0^t $ |
The integral starts at λ=0 because the product (the integrand) is 0 for λ<0 |
Convolution of a step and a pulse, $f(t)=0.4\cdot(\gamma(t)-\gamma(t-2.5)), \quad h(t)=\gamma (t)$
Region / Integral |
Graph | Notes |
Region 1, t<0 $\int_{ - \infty }^t = 0$ |
Trivial, not shown | The integral is 0 because the product at λ=0 because the product (the integrand) is 0 if t<0. |
Region 2, 0≤t<2.5 $\int_0^t $ |
The integral starts at λ=0 because the product (the integrand) is 0 for λ<0 (0 is the left sside of the magenta rectangle). It stops at λ=t because the product is 0 for λ>t (to the right of the magenta rectangle). Since both functions are constant throughout the integration, the product is just a rectangle whose width varies as t varies. The width=t, height=0.4, so area =0.4·t. |
|
Region 3, 1≤t<2 $\int_{ t-2.5}^t $ |
The integral starts at λ=t-2.5 because the product (the integrand) is 0 for smaller values of λ (t-2.5 is the left side of the magenta rectangle). It stops at λ=t because the product is 0 for λ>t (to the right of the magenta rectangle). Since both functions are constant throughout the integration, the product is just a rectangle whose width is 2.5 and whose height is 0.4 (area=1).. |
Convolution of triangular pulse, f(t), and a unit step function, h(t).
Region / Integral |
Graph | Notes |
Region 1, t<0 $\int_{ - \infty }^t = 0$ |
Trivial, not shown | The integral is 0 because the product at λ=0 because the product (the integrand) is 0 if t<0. |
Region 2, 0≤t<1 $\int_0^t $ |
The integral starts at λ=0 because the product (the integrand) is 0 for λ<0 (0 is the left of the magenta triangle). It stops at λ=t because the product is 0 for λ>t (to the right of the magenta triangle). The area (i.e., the convolution) is simply the area of the magenta triangle (width=t, height=2t, area=t2). |
|
Region 3, 1≤t<2 $\int_0^{t-1} + \int_{t-1}^t $ |
There are two integrals, one to the left of the apex (at t-1) and one to the right. The product (magenta) to the left of the apex is a trapezoid with width=t-1; this integral goes from 0 to t-1. The product to the right of the apex is a triangle with width=1, height=2; this integral goes from t-1 to t. The product is zero elsewhere and so doesn't contribute to the integral. The area (i.e., the convolution) is th sum of the area of the magenta trapezoid to the left of the apex, and the magenta triangle to the right. |
|
Region 4, 2≤t $\int_{t-2}^{t-1} + \int_{t-1}^t $ |
The integral is defined piecewise.
The final resultst is just an isosceles triangle whose width is 2 and whose height is 2 (area=2).. |
Convolution of two rectangular pulses of different width, $f(t)=\gamma(t)-\gamma(t-2), \quad h(t)=2\cdot(\gamma(t)-\gamma(t-1))$
Note: if the pulses have the same width there is no flat spot in the middle of the output, and only 4 regions for integration.
Region / Integral |
Graph | Notes |
Region 1, t<0 $\int_{ - \infty }^t = 0$ |
Trivial, not shown | The integral is 0 because the product at λ=0 because the product (the integrand) is 0 if t<0. |
Region 2, 0≤t<1 $\int_0^t $ |
The integral starts at λ=0 because the product (the integrand) is 0 for λ<0 (0 is the left of the magenta rectangle). It stops at λ=t because the product is 0 for λ>t (to the right of the magenta rectangle). Since both functions are constant throughout the integration, the product is just a rectangle whose width varies as t varies. Width=t, height=2 so area= 2·t. |
|
Region 3, 1≤t<2 $\int_{t-1}^t $ |
The integral starts at &lambda=t-1 because the product (the integrand) is 0 for smaller values of λ (t-1 is the left side of the magenta rectangle). It stops at λ=t because the product is 0 for λ>t (to the right of the magenta rectangle). Since both functions are constant throughout the integration, the product is just a rectangle whose width is 1. |
|
Region 4, 2≤t<3 $\int_{t-1}^2 $ |
The integral starts at &lambda=t-1 because the product (the integrand) is 0 for smaller values of λ (t-1 is the left side of the magenta rectangle). It stops at λ=2 because the product is 0 for λ>t (to the right of the magenta rectangle). Since both functions are constant throughout the integration, the product is just a rectangle whose width varies as t varies. Width=3-t, height=2, area=6-2·t. |
|
Region 5, 3≤t $\int_{t-1}^t = 0 $ |
Trivial, not shown | The integral The integral is 0 because the product at λ=0 because the product (the integrand) is 0 if t>3. |
As a challenge, figure this one out yourself:
Heres an even trickier one: