Scroll back to top

    Convolution

    Why Is Convolution Important?

    Imagine you are a doctor and to fight an infection you must give your patients 3 doses of medicine.

    Doses = 3

    At the beginning of the week, you have 1 patient. This number increases throughout the week by 1 patient each day. By Friday, you have 5 patients.

    Number of patients per day = [1 2 3 4 5]

    If you wanted to calculate the total number of doses you administer over the week, you would multiply the doses by the number of patients per day and sum this.

    Total doses = [3 6 9 12 15] = 45

    However, imagine the disease evolves. Now, you have to give each patient 3 doses on the first day, 2 doses on the second day, and 1 dose on the third day.

    Doses = [3 2 1]

    Now, how many total doses are administered each day? Each week? This suddenly became more complicated, but convolution is the key to solving this problem.

    What Is Convolution?

    This is a way to take two functions and apply them to each other. You would take the first function and map the second function to it. Simplistically, you are taking both functions and doing a fancy multiplication and sum of them. Here is the total equation. Sometimes, we do not know the output of a system, y(t), but we do know the input, x(t) and the impulse response, h(t). The convolution function allows us to use x(t) and h(t) to solve for y(t). y(t) = x(t) * h(t) Important: the asterisk (*) is the symbol used for convolution. It does not mean multiplication. This also can be expressed analytically with an integral.

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

    Properties of Convolution

    The communicative property:

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

    The distributive property:

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

    The associative property:

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

    Example Problem

    Returning to the doctor administering doses scenario from earlier, we will determine the total number of doses per day and per week.

    First, flip the number of patients per day.

    New number of patients per day = [5 4 3 2 1]

    The doses remain the same. You have to give each patient 3 doses on the first day, 2 doses on the second day, and 1 dose on the third day.

    Doses = [3 2 1]

    Line the two arrays so that the doses start at the end of the number of patients per day as shown below.

    [3 2 1]

    [5 4 3 2 1]

    Multiple the numbers that are aligned vertically, so 3*1=3. There are 3 doses administered on the first day.

    Slide the doses array one number to the left as shown below.

    [3 2 1]

    [5 4 3 2 1]

    Again, multiple the numbers that are aligned vertically, so (3*2)+(2*1)=8. There are 8 doses administered on the second day. We repeat this process until the end of the doses (1) is aligned with the beginning of the number of patients per day array (5).

    Slide the doses array one number to the left as shown below.

    [3 2 1]

    [5 4 3 2 1]

    Multiple the numbers that are aligned vertically, so (3*3)+(2*2)+(1*1)=14. There are 14 doses administered on the third day.

    Slide the doses array one number to the left as shown below.

    [3 2 1]

    [5 4 3 2 1]

    Multiple the numbers that are aligned vertically, so (3*4)+(2*3)+(1*2)=20. There are 20 doses administered on the fourth day.

    Slide the doses array one number to the left as shown below.

    [3 2 1]

    [5 4 3 2 1]

    Multiple the numbers that are aligned vertically, so (3*5)+(2*4)+(1*3)=26. There are 26 doses administered on the fifth day.

    Slide the doses array one number to the left as shown below.

    [3 2 1]

    [5 4 3 2 1]

    Multiple the numbers that are aligned vertically, so (3*0)+(2*5)+(1*4)=14. There are 14 doses administered on the sixth day.

    Slide the doses array one number to the left as shown below.

    [3 2 1]

    [5 4 3 2 1]

    Multiple the numbers that are aligned vertically, so (3*0)+(2*0)+(1*5)=5. There are 5 doses administered on the seventh day.

    We can make a new array of total doses.

    New total doses = [3 8 14 20 26 14 5]

    Summing this array, the total doses administered over the week is 90.