Convolution
Convolution is a mathematic operation that can be performed on two functions, which produces a third output function which is a “blend” of the two inputs. Physically, when convoluting a signal with another function, it somewhat represents the “smearing” of the signals energy (in time) with respect to the shape of the second function.
1D convolution is commonly used in digital signal processing (DSP) algorithms.
2D convolution is commonly used in image processing to perform edge detection and blurring. Conversely, deconvolution is commonly used to sharpen images. The image is convolved with a kernel or convolution matrix, a typically small matrix which mixes the signal of one pixel with the surrounding pixels.
Formal Definition
where:
are functions that vary in time (signals)
is used to denote the convolution of signals and .
The result will be another function which varies with time.
Mathematical Properties
Convolution is commutative:
Convolution is associative:
Convolution is distributive:
These other properties also hold true:
Calculating A Convolution Of Two Box-Car Functions
Setup
One of the easiest convolution calculations that has a closed-form solution is that of two “box-car” signals.
is defined by:
And is exactly the same:
We need to “flip” to give :
Then we need to shift by to give :
Now we to vary from to , and at each , multiply the two signals together , and calculate the total area under this new signal (mathematically, the integral between and ). This area is the value of the convolution at time .
Obviously, varying from to manually is impossible, but we can break this problem down into sections, and calculate the equation for the convolution function for each section. Because box-car functions are not continuous, we need to break the problem down into sections were each section can describe the convolution in a continuous form.
t < 0
When the two box-cars do not intersect at all, thus the product of and is always 0, and thus the area is also 0, which means the value of the convolution function when is also 0:
0 <= t < 1
When , the two box-car functions begin to intersect, with the amount if intersection increasing with . Where they intersect, the product of the two functions is also . This product is shown as the green line below.
From visual inspection of the green plot, it is obvious that the area under the curve is going to be width*height, which in this case is . Mathematically this can be calculated by:
1 <= t < 2
When , the functions still intersect, but they are beginning to separate. The area is again width*height, where the width is from to , and the height is still .
We can calculate a function for the convolution in this interval with:
t >= 2
When , the two box-cars do not intersect at all (just like when ):
Mathematically we can write this as:
Combining The Sections
Now that we have derived functions for all of the relevant sections of the convolution function, we can combine them piece-wise to get the final answer:
Convolution With Unit Impulse (Dirac Delta) Function
Convolution of any function with the unit impulse function (also known as the Dirac delta function) will always result in (the original function, unmodified).
In this sense, the unit impulse function can be considered as the identity function when it comes to convolution (just like the identity matrix in matrix multiplication leaves the original matrix unchanged).
The Convolution Theorem
The convolution theorem states that convolution in the time domain is equal to multiplication in the frequency domain. Mathematically:
We can write the above equation as: