 # Convolution 1 Cuthbert Nyack
The mathematical expression for the convolution of 2 functions f1(t) and f2(t) is given by the equation below:- The proceedure for calculating the convolution is illustrated diagrammatically below. First express f1(t) as f1(tau), then f2(t) as f2(-tau) and as f2(t - tau). For the case illustrated below f2(t) = 1 - 2t and f2(tau) = 1 - 2tau for tau between 0 and 0.5. Therefore f2(-tau) = 1 + 2tau for tau between 0 and -0.5 and f2(t - tau) = 1 - 2(t - tau) for tau between t and t - 0.5. The green curve below shows t = 0.7 and therefore f2(t - tau) = -0.4 + 2tau for tau between 0.2 and 0.7. The product f1(tau)f2(t - tau) function gives the convolution of the 2 functions, when integrated over all tau for which the product is nonzero, at this particular value of t. Depending on the analytic expressions for f1 and f2, one integration may be sufficient to obtain an analytic expression for the convolution. In the case below the integration must be carried out 3 times to obtain 3 expressions for the convolution covering the 3 ranges of t (0 to 0.5), (0.5 to 1.0) and (1.0 to 1.5). In cases where f1 and f2 are available only in numerical form(eg. sampled data) then the integral must be evaluated for all values of t for which the convolution is desired. For the value of t = 0.7, f2(t - tau) is shown in green and the product f1(tau)f2(t - tau) is just equal to f2(t - tau) because f1(tau) = 1 over the range of tau for which f2(t - tau) is nonzero. The convolution therefore is the integral of f2(t - tau) and is the area under the green triangle(shaded as striped purple. Since the height of the triangle is 1 and its width is 1/2, then its area is 1/4 which is the convolution for that value of t. In fact this is also the case for t between 0.5 and 1. For t between 0 and 0.5
f2(t - tau) is shown in cyan for t = 0.15 and the product is shown as the area in yellow. This area is (t - t*t) and is the value of the convolution for t between 0 and 0.5.
For t between 1 and 1.5 the product function is shown as the area shaded in red for t = 1.3. This area is (t*t - 3*t + 9/4) and is the convolution for t between 1.0 and 1.5
For t less than 0 or greater than 1.5, the convolution is zero.

The applet below shows the convolution as t is changed.

The purple line is f1(tau), the orange line is f2(t - tau) and moves as t is changed by the scrollbar. f2(t - tau) is shifted upwards slightly to distinguish it from f1(tau). The red line at the bottom shows the convolution of the 2 functions. As t is changed, the filled green area shows the area under the product function f1(tau)f2(t - tau) and the green line at the bottom shows the value(area of green shading) of the convolution at the current value of t. The gain scrollbar can be used to expand the plot of the convolution.
The Applet below shows the convolution of the same 2 functions as above. In this case f2 is fixed and f1 is moved. Although the shaded green area may appear reversed or shifted, its magnitude is the same as in the above case for any given value of t. As above the shifted applet is displaced upwards slightly to avoid overlap with the stationary one. The expressions for the convolution in the 3 ranges of interest can also be evaluated with f2 fixed and f1 movable. The result will be the same as the expressions above.