[Math] Calculating convolution integral analytically

contour-integrationconvolutiondefinite integralsfourier analysissignal processing

How can i compute convolution integral analytically, without using graphs. I hate using graphs, shiftings which are error prone. If this is possible can you explain what way i must follow?

For example:
Let the input $x(t) = 1$ for $0<t<T$ and $0$ otherwise

let unit impulse response $h(t) = t$ for $0<t<2T$ and $0$ otherwise

This is very straight forward to solve example taken from my signals and systems book. But I'm looking for purely analytic solution.

Best Answer

There is a way to do this analytically using Fourier transforms. I will show this as soon as I can, but I promise you, it will be a lot messier than what I present below.

GRAPHICAL METHOD

To do this at the level of an undergrad signals class, you really need to draw a picture. But while it may be error-prone, there are checks along the way to see that you are doing it correctly.

The convolution integral is given by

$$x*h(t) = \int_{-\infty}^{\infty} dt' \, x(t-t') h(t') $$

The key here is to figure out what $x(t-t')$ is. I will let you figure out why

$$x(t-t') = \begin{cases} 1 & t-T \lt t' \lt t \\ 0& (t' \lt t-T) \cup(t'\gt t) \end{cases} $$

Now we may resolve the integral graphically as the area of intersection of the rectangle $x$ and the triangle $h$. You should see that $x*h(t)=0$ when $t \lt 0$. Next, note that, as we increase $t$, the region of intersection is a right triangle and the convolution integral is

$$\int_0^t dt' \, 1 \cdot t' = 1/2 t^2$$

This is true until $t=T$, when the left side of the rectangle crosses the axis. When $t \gt T$, the integral is now

$$\int_{t-T}^t dt' \, 1 \cdot t' = T \left (t-\frac{T}{2} \right )$$

When $t \gt 2 T$, the right side of the rectangle extends out past the triangle, so the convolution integral is now

$$\int_{t-T}^{2 T} dt' \, 1 \cdot t' = \frac12 (3 T^2+2 T t-t^2)$$

When $t \gt 3T$, the convolution is zero.

Please observe this by drawing the graphs. It may take several drawings, but you will see this.

To sum, we have

$$x*h(t) = \begin{cases} 0 & t \lt 0 \\\frac12 t^2 & 0 \lt t \lt T \\T \left (t-\frac{T}{2} \right ) & T \lt t \lt 2 T \\ \frac12 (3 T^2+2 T t-t^2) & 2 T \lt t \lt 3 T\\ 0 & t \gt 3 T \end{cases} $$

ANALYTICAL METHOD

Here we may use the convolution theorem for Fourier transforms:

$$\int_{-\infty}^{\infty} dt' \, h(t') x(t-t') = \frac1{2 \pi} \int_{-\infty}^{\infty} d\omega \, H(\omega) X(\omega) \, e^{-i \omega t} $$

where $H$ and $X$ are the respective Fourier transforms of $h$ and $x$. In this case:

$$X(\omega) = \int_0^T dt \, e^{i \omega t} = \frac{e^{i T \omega}-1}{i \omega} $$ $$H(\omega) = \int_0^{2 T} dt \, t \, e^{i \omega t} = \left (\frac1{\omega^2} - \frac{i 2 T}{\omega} \right ) e^{i 2 \omega T} - \frac1{\omega^2} $$

Thus, after some algebra, we find the convolution integral to be

$$\frac1{i 2 \pi} \int_{-\infty}^{\infty} d\omega \, \left [e^{i (3 T-t) \omega} \left (\frac1{\omega^3} - \frac{i 2 T}{\omega^2} \right ) - e^{i (2 T-t) \omega} \left (\frac1{\omega^3} - \frac{i 2 T}{\omega^2} \right ) - \frac1{\omega^3} e^{i (T-t) \omega} + \frac1{\omega^3} e^{-i t \omega} \right ] $$

This looks like a heck of an integral to do out. One way we can attack it is to use contour integration in the complex plane. (I warned you.)

So let's first consider

$$PV \int_{-\infty}^{\infty} d\omega \, e^{i (3 T-t) \omega} \left (\frac1{\omega^3} - \frac{i 2 T}{\omega^2} \right ) $$

Note that, when we break the integral apart, each piece on its own does not converge. So we consider the Cauchy principal value of the integral, knowing that when we put everything back together, the singular pieces should drop out and we will have our nice convolution integral again.

So now consider the contour integral

$$\oint_C dz \, e^{i (3 T-t) z} \left (\frac1{z^3} - \frac{i 2 T}{z^2} \right ) $$

where $C$ is a semicircular contour of radius $R$ in the upper half plane with a small semicircular detour of radius $\epsilon$ about the origin into the contour when $t \lt 3 T$ and $C$ is a semicircular contour of radius $R$ in the lower half plane with a small semicircular detour of radius $\epsilon$ about the origin into the contour when $t \gt 3 T$.

(If you need to understand why the contours need to be in the upper or lower half-planes like this, there are lots of resources on M.SE which address this very point. I will not do it here as it takes away from the discussion at hand.)

When $R \to \infty$ and for small $\epsilon$, we evaluate the contour integral in each case and apply Cauchy's theorem, i.e., the contour integral is zero. In this example, I will write everything out - here, let's use the upper contour:

$$PV \int_{-\infty}^{\infty} d\omega \, e^{i (3 T-t) \omega} \left (\frac1{\omega^3} - \frac{i 2 T}{\omega^2} \right ) + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \, e^{i (3 T-t) \epsilon e^{i \phi}} \left (\frac1{\epsilon^3 e^{i 3 \phi}} - \frac{i 2 T}{\epsilon^2 e^{i 2 \phi}} \right ) =0$$

Now, we expand out the exponential, collect like terms in $\epsilon$, and integrate. The result is, for small epsilon and $t \lt 3T$

$$\frac1{i 2 \pi} PV \int_{-\infty}^{\infty} d\omega \, e^{i (3 T-t) \omega} \left (\frac1{\omega^3} - \frac{i 2 T}{\omega^2} \right ) + \frac1{\pi} (t-T) \frac1{\epsilon} +\frac14 (t^2-2 T t-3 T^2) = 0$$

For $t \gt 3 T$, we now integrate over the detour from $\pi$ to $2 \pi$ instead, and the result is

$$\frac1{i 2 \pi} PV \int_{-\infty}^{\infty} d\omega \, e^{i (3 T-t) \omega} \left (\frac1{\omega^3} - \frac{i 2 T}{\omega^2} \right ) + \frac1{\pi} (t-T) \frac1{\epsilon} -\frac14 (t^2-2 T t-3 T^2) = 0$$

OK, you may have also noticed that we have a term in $1/\epsilon$, which becomes singular as $\epsilon \to 0$. That's OK, because we have other pieces of the integral which will also have singular pieces, and we expect the singular parts to cancel prior to taking the limit as $\epsilon \to 0$.

The other integrals I will just state and allow the interested reader to work out for him/her/themself:

$$t \lt 2 T$$ $$-\frac1{i 2 \pi}PV \int_{-\infty}^{\infty} d\omega \, e^{i (2 T-t) \omega} \left (\frac1{\omega^3} - \frac{i 2 T}{\omega^2} \right ) - \frac{t}{\pi} \frac1{\epsilon} - \frac1{4} (t^2-4 T^2) = 0 $$

$$t \gt 2 T$$ $$\frac1{i 2 \pi}PV \int_{-\infty}^{\infty} d\omega \, e^{i (2 T-t) \omega} \left (\frac1{\omega^3} - \frac{i 2 T}{\omega^2} \right ) - \frac{t}{\pi} \frac1{\epsilon} + \frac1{4} (t^2-4 T^2) = 0 $$

$$$$

$$t \lt T$$ $$-\frac1{i 2 \pi}PV \int_{-\infty}^{\infty} d\omega \, e^{i (T-t) \omega} \frac1{\omega^3} - \frac{t-T}{\pi} \frac1{\epsilon} - \frac1{4} (T-t)^2 = 0 $$

$$t \gt T$$ $$\frac1{i 2 \pi}PV \int_{-\infty}^{\infty} d\omega \, e^{i (T-t) \omega} \frac1{\omega^3} - \frac{t-T}{\pi} \frac1{\epsilon} + \frac1{4} (T-t)^2 = 0 $$

$$$$

$$t \lt 0$$ $$\frac1{i 2 \pi}PV \int_{-\infty}^{\infty} d\omega \, e^{-i t \omega} \frac1{\omega^3} + \frac{t}{\pi} \frac1{\epsilon} + \frac1{4} t^2 = 0 $$

$$t \gt 0$$ $$\frac1{i 2 \pi}PV \int_{-\infty}^{\infty} d\omega \, e^{-i t \omega} \frac1{\omega^3} + \frac{t}{\pi} \frac1{\epsilon} - \frac1{4} t^2 = 0 $$

Now, we have to combine the above results to form the final convolution integral. It is worth laying out exactly how we are going to combine these results. I will illustrate with the following array:

$$\begin{array}\\ & 0 & T & 2 T & 3 T \\ t < 0 & < & < & < & < \\ 0< t < T & > & < & < & < \\ T \lt t \lt 2 T & > & > & < & < \\ 2 T \lt t \lt 3 T & > & > & > & < \\ t \gt 3 T & > & > & > & > \end{array} $$

The $\lt$ or $\gt$ denotes which of the results (e.g., $t \gt 3 T$ or $t \lt 3 T$) we are using for the value of $t$ in the respective row. Note that, no matter how we combine the results, the singular $1/\epsilon$ terms will cancel.

So, for example, for $t \lt 0$, we combine all of the "less than" results above. And, fortunately, we find that everything cancels and the result is zero, as we expect. In fact, I leave it as an exercise for the reader to verify that, by combining the results as specified in the above matrix, that we reproduce the results obtained by computing the integral graphically.

Still want to do the convolution integrals analytically?

ADDENDUM

Here's a plot for the case $T=2$:

enter image description here

Related Question