Skip to the content of the web site.

Lecture 19

Lecture 18 | Lecture 20

The Convolution

An integral which appears in almost all forms of engineering is the convolution of two functions defined as

tex:$$\int_0^\infty f(\tau) g(t - \tau) d\tau$$.

We will begin with two examples as motivation, but these are for the students who are interested in understanding why we are doing the convolution. You may skip to the class material.

Motivation: A Leaky Mug

Consider the leaky mug shown in Figure 1.

Figure 1. A leaky mug.

If the mug contains tex:$$m\,{\rm cL}$$ of fluid at time tex:$$t = 0$$ and the mug leaks at a rate of tex:$$1\,{\rm cL/s}$$, then the amount of fluid in the mug may be described by the function in Figure 2.

Figure 2. The amount of liquid in a leaky mug starting with tex:$$20\,{\rm cL}$$ at time tex:$$t = 0$$.

If while the mug is emptying, another tex:$$10\,{\rm cL}$$ is put into the mug at time tex:$$t = 15$$, the function describing the amount of liquid becomes what is seen in Figure 3.

Figure 3. The amount of liquid in a mug when tex:$$20\,{\rm cL}$$ and tex:$$10\,{\rm cL}$$ are added at times tex:$$t = 0$$ and tex:$$t = 15$$, respectively.

What happens, however, if the the mug is being filled from a tap, as is shown in Figure 4.

Figure 4. A leaky mug with a faucet.

Suppose that we start turning on the faucet at time and after two seconds, we reached a flow of tex:$$4\,{\rm cL/s}$$ and we start shutting off the faucet after 15 seconds until the faucet stops running after 17 seconds. The plot of the rate of flow of the faucet is shown in Figure 5.

Figure 5. The rate of flow of the faucet in units of centilitres per second.

What function describes the total amount of fluid in the mug? In this case, the problem is actually very difficult to describe because the differential equation which describes this problem is non-linear! The rate of change of volume involves the unit step function tex:$$\dot{V}(t) = -u(V(t))$$ and this is without a faucet.

With significant effort, is is possible to determine that the amount of fluid in the mug is as is shown in Figure 6, the maximum begin achieved at time tex:$$t = 16.5\,s$$. The actual function is tex:$$V(t) = \cases{
$0$ & $t \le 0.5$ \cr
$(t - 0.5)^2$ & $t \le 2$ \cr
$3t - 3.75$ & $t \le 15$ \cr
$3t - 3.75 - (t - 15)^2$ & $t \le 17$ \cr
$60.25 - t$ & $t \le 60.25$ \cr
$0$ & $t > 60.25$

Figure 6. The total amount of fluid in the mug while being filled according to the function in Figure 5.

It is exceptionally fortunate that circuits made out of resistors, inductors, and capacitors is linear, and we will use this in the next example to justify the convolution integral.

Motivation: Discharging Capacitors

Consider the circuit in Figure 7. The differential equation of this circuit is tex:$$\dot{q} + q = f(t)$$ where tex:$$q(t)$$ is the charge on the capacitor.

Figure 7. A circuit with a capacitor, three resistors, and a voltage source.

If the voltage source is zero (the system is homogeneous) and the capacitor has a charge of tex:$$Q$$ coulombs at time tex:$$t = 0$$, the capacitor would discharge according to the function tex:$$q(t) = Qe^{-t}$$. If the charge on the capacitor is initially zero and a charge of size tex:$$Q$$ is only placed on the capacitor at time tex:$$t = 0$$ (we shocked the system with the charge tex:$$Q$$), the function describing the charge is defined by tex:$$q(t) = Qe^{-t}u(t)$$ where tex:$$u(t)$$ is the unit step function. If we shock the system at time tex:$$t = a$$, the charge on the capacitor then falls according to the function tex:$$q(t - a)$$.

For clarity, we will now define tex:$$\tilde{q}(t) = e^{-t}u(t)$$.

Using the Impulse Function

From your ECE 140 course, you are able to determine the response to a system when the voltage is constant. If you consider the functions we previously used to define the impulse function, tex:$$f_\delta(t) = \frac{1}{\delta}(u(t) - u(t - \delta))$$, it is possible to determine the response: initially, the charge is zero; during the phase of duration tex:$$\delta$$, the voltage is constant and the capacitor is being charged; and when the voltage is turned off, the capacitor discharges again. Figure 8 shows the charge of the capacitor for tex:$$f_\delta(t)$$ where tex:$$\delta$$ runs from 1 down to 0.01 in steps of 0.01.

Figure 8. The charge on the capacitor when the voltage is defined by the function tex:$$f_\delta(t)$$ for tex:$$\delta$$ running from 1 down to 0.01 in steps of 0.01.

To emphasize the impulse, Figure 9 includes the impulse function. You will note that the area under the pulse is always 1, but as it becomes more narrow, its voltage increases.

Figure 9. The addition of the impulse to the function shown in Figure 8.

It seems plausible, therefore, to believe that the solution to the differential equation tex:$$\dot{q} + q = \delta(t)$$ where the capacitor is initially discharged is tex:$$\tilde{q}(t) = e^{-t}u(t)$$ and that if the impulse is tex:$$\dot{q} + q = Q\delta(t)$$, the response is tex:$$Q\tilde{q}(t) = Qe^{-t}u(t)$$.

Suppose now we shock the system twice: first at time tex:$$t = 0$$ with tex:$$2\,{\rm C}$$ and then again at time tex:$$t = 1$$ with tex:$$3\,{\rm C}$$. After 1 second, the charge on the capacitor has already decayed to tex:$$2/e\, {\rm C}$$, but then we added another tex:$$3\, {\rm C}$$ and so now the charge begins to decay starting from tex:$$3 + 2/e\, {\rm C} \approx 4.36\,{\rm C}$$, as is shown in Figure 10.

Figure 10. The response of a capacitor shocked with 2 and 3 coulombs at times 0 and 1, respectively.

We may already represent these two shocks using the impulse function tex:$$f(t) = 2\delta(t) + 3\delta(t - 1)$$ and the response is tex:$$2\tilde{q}(t) + 3\tilde{q}(t - 1)$$. What do we do, however, if the voltage is defined by a function tex:$$f(t)$$ as in tex:$$\dot{q} + q = f(t)$$, as opposed to shocks?

Consider, for example, the function tex:$$f(t) = \sin(t)(u(t) - u(t - \pi))$$ shown in Figure 11.

Figure 11. The function tex:$$f(t) = \sin(t)(u(t) - u(t - \pi))$$.

Recall also that while electrical power is alternating, it is possible to approximate a function using a rectified and modulated current, as can be seen in Figure 12 where the rectified sinusoids are appropriately scaled so that the total area remains the same.

Figure 12. An approximation of the function in Figure 11 using appropriately scaled rectified sinusoids.

Using this idea, could we not not approximate a sub-interval by an impulse function multiplied by the area of the function on that sub-interval? In this case, we could approximate the function by a sequence of impulses. For example, if we were to divide the interval into tex:$$n$$ equally spaced sub-intervals, denoted the width of each interval by tex:$$\Delta_k$$ and chose a representative point tex:$$\tau_k^*$$ in each sub-interval, it follows that an approximation of the area on each interval is tex:$$f(\tau_k^*) \Delta_k$$ and therefore we may represent the function as tex:$$f(t) \approx \sum_{k = 0}^n f(\tau_k^*) \Delta_k \delta(t - \tau_k^*)$$.

For example, consider the image in Figure 13.

Figure 13. An approximation of the function in Figure 11 using appropriately impulse functions.

Note: this approximation is only valid with respect to the operation of integration.

The beauty of this method now comes from the observation that we already know the response of the system to each of these impulse functions: tex:$$f(\tau_k^*) \Delta_k \tilde{q}(t - \tau_k^*)$$ and therefore the total response is the sum of these responses:

tex:$$\sum_{k = 0}^n f(\tau_k^*) \Delta_k \tilde{q}(t - \tau_k^*)$$

This response is shown in Figure 14 where you will note that initially the charge on the capacitor is 0 and then with each impulse, the charge on the capacitor is correspondingly increased.

Figure 14. The response to a sequence of appropriately weighted impulse functions.

Now, rewrite the sum as

tex:$$\sum_{k = 0}^n \left( f(\tau_k^*) \tilde{q}(t - \tau_k^*) \right ) \Delta_k $$

and you will note that it looks like the Riemann approximation of an integral, and as tex:$$\Delta_k \rightarrow 0$$, it must converge to the integral.

tex:$$\int_0^\infty f(\tau) \tilde{q}(t - \tau) d\tau$$.

But this is the convolution integral defined at the very start of this topic. Therefore, it follows that we can use this convolution to find the response of a system:

tex:$$y(t) = \frac{1}{2}\left( (e^{-t} - \cos(t) + \sin(t))u(t) + (e^{-t+\pi} + \cos(t) - \sin(t))u(t - \pi) \right)$$.

You will note that after time tex:$$t = \pi$$, the sinusoids cancel and the function is just a decaying exponential. The plot of this function superimposed on Figure 14 is shown in Figure 15.

Figure 15. The convolution response plotted over the approximation shown in Figure 14.

The Convolution and its Uses

The convolution function is so often used in engineering that not only does it have a special name, but it also has a special notation:

tex:$$y(t) = (x * h)(t) = \int_{-\infty}^\infty x(\tau) h(t - \tau) d\tau$$.

With a little effort, you can show that the operation of the convolution is symmetric:

tex:$$(x * h)(t) = (h * x)(t)$$.

The Convolution and Causal Systems

A system is causal if the response to an input signal tex:$$x(t)$$ at time tex:$$t_0$$ depends only on the values of the function for tex:$$t \le t_0$$ (e.g., you do not expect your stereo to respond until you actually push a button). One consequence of causality of a linear system is that the response tex:$$h(t)$$ to the impulse function tex:$$\delta(t)$$ is 0 for tex:$$t < 0$$.

In many cases, we are also working with signals which start at time tex:$$t = 0$$, and consequently, the input tex:$$x(t)$$ will also be 0 for tex:$$t < 0$$.

If both functions are zero for time tex:$$t < 0$$, the convolution simplifies to

tex:$$y(t) = (x * h)(t) = \int_0^t x(\tau) h(t - \tau) d\tau$$

as tex:$$x(\tau) = 0$$ for tex:$$\tau < 0$$ and tex:$$h(t - \tau) = 0$$ for tex:$$\tau > t$$ which is the form given in AMEM.

The Convolution and the Laplace Transform

Suppose we are working in the frequency domain by using the Laplace transform. What is the Laplace transform of the convolution?

From the definition, we have that

tex:$$Y(s) = \int_0^\infty e^{-st} \left( \int_0^t x(\tau) h(t - \tau)d\tau\right) dt$$.

Because the function tex:$$x(\tau)$$ is causal, we may extend the inner integral to infinity:

tex:$$= \int_0^\infty e^{-st} \left( \int_0^\infty x(\tau) h(t - \tau)d\tau\right) dt$$.

We can now perform a change of variables: tex:$$\eta = t - \tau$$ and therefore tex:$$d\eta = dt - \tau$$. Hence, the transform becomes

tex:$$= \int_0^\infty e^{-s(\tau + \eta)} \left( \int_0^\infty x(\tau) h(\eta)d\tau\right) d\eta$$.

Switching the integrals, we have:

tex:$$= \int_0^\infty e^{-s\tau} x(\tau) \left( \int_0^\infty e^{-s\eta} h(\eta)d\eta\right) d\tau$$
tex:$$= \int_0^\infty e^{-s\tau} x(\tau) H(s) d\tau$$
tex:$$= H(s) \int_0^\infty e^{-s\tau} x(\tau) d\tau$$
tex:$$= H(s) X(s)$$

The conclusion is that

tex:$$x(t)*h(t) \leftrightarrow X(s)H(s)$$.

This is the Convolution Theorem. An alternate proof is given in AMEM, p.196.

The convolution theorem may be used to find the inverse Laplace transform; for example,

tex:$$\frac{a}{s^2(s^2 + a^2) = \frac{1}{s^2}\frac{a}{s^2 + a^2}$$

but tex:$$t \leftrightarrow \frac{1}{s^2}$$ and tex:$$\frac{a}{s^2 + a^2} \leftrightarrow \sin(at)$$. Therefore, by the convolution theorem,

tex:$$\frac{a}{s^2(s^2 + a^2)} \leftrightarrow t * \sin(at)$$.

You may now use the convolution:

tex:$$\frac{a}{s^2(s^2 + a^2)} \leftrightarrow \int_0^t (t - \tau) \sin(a\tau) d\tau = \cdots = \frac{at - \sin(at)}{a^2}$$.

Another Example: Integral Equations

Integral equations are equations where the unknown function appears within an integrand. If the integral is in the form of a convolution, the Laplace transform method may be used. For example, consider

tex:$$x(t) + \int_0^t K(t - \tau)x(\tau) d\tau = f(t)$$

where tex:$$K(t)$$ is called the kernel and is given and tex:$$f(t)$$ is the forcing function.

Suppose, for example, that the kernel is tex:$$K(t) = t^2$$ and the forcing function is tex:$$f(t) = \sin(t)$$; thus, we have:

tex:$$x(t) + \int_0^t (t - \tau)^2 x(\tau) d\tau = \sin(t)$$

and by taking the Laplace transform of each side, tex:$$x(t) \leftrightarrow X(s)$$, tex:$$\sin(t) \leftrightarrow \frac{1}{s^2 + 1}$$, and tex:$$t \leftrightarrow \frac{1}{s^2}$$; therefore we have

tex:$$X(s) + \frac{1}{s^2}X(s) = \frac{s}{s^2 + 1}$$.

Solving for tex:$$X(s)$$, we have:

tex:$$X(s)\left(1 + \frac{1}{s^2}\right) = \frac{1}{s^2 + 1}$$
tex:$$X(s)(s^2 + 1) = \frac{s^2}{s^2 + 1}$$
tex:$$X(s) = \frac{s^2}{(s^2 + 1)(s^2 + 1)}$$

Using the Laplace transform, we have that

tex:$$x(t) = \cos(t)*\cos(t) \leftrightarrow \frac{s}{s^2 + 1} \frac{s}{s^2 + 1}$$


tex:$$x(t) = \cos(t)*\cos(t) = \int_0^t \cos(\tau) \cos(t - \tau) d\tau = \cdots = \frac{1}{2}(sin(s) + s cos(s))$$.