Fourier Transform and Convolution

Tags:
1. Oct 9, 2015

ecastro

Considering two functions of $t$, $f\left(t\right) = e^{3t}$ and $g\left(t\right) = e^{7t}$, which are to be convolved analytically will result to $f\left(t\right) \ast g\left(t\right) = \frac{1}{4}\left(e^{7t} - e^{3t}\right)$.

According to a Convolution Theorem, the convolution of two functions can be solved by the use of Fourier Transforms. The theorem states that,

$f\left(t\right) \ast g\left(t\right) = \mathcal{F}^{-1} \left\{\mathcal{F}\left[f\left(t\right)\right] \cdot \mathcal{F}\left[g\left(t\right)\right]\right\}$.

Thus, if I were to transform $f\left(t\right)$ and $g\left(t\right)$, multiply them per component and take the inverse transform, I should get the same function that was solved analytically. I tried doing this in MatLab, but they're two totally different functions. Also, I tried using MatLab's built-in function for convolution $\texttt{conv}$, but the resulting size of the matrix is almost twice as large, and the graph is off by several units (although the graph from the Fourier Transform approach and the latter share the same shape). Did I miss anything on why this is so?

Here is my code:
Code (Text):
clear; clc;

t = 0:0.01:1;
y = (1/4).*(exp(7.*t) - exp(3.*t));

f = exp(3.*t); g = exp(7.*t);
F = fft(f); G = fft(g);

FG = ifft(F.*G); FG2 = conv(f, g);
t2 = 0:0.005:1;
The variable $\texttt{t2}$ is for the drawing of the plot of the Fourier Transform approach and the $\texttt{conv}$ approach in the same graph.

2. Oct 9, 2015

blue_leaf77

How do you get this
?

3. Oct 9, 2015

ecastro

Replacing $t$ to $x$, $f\left(x\right) = e^{3x}$ and $g\left(x\right) = e^{7x}$. The definition of convolution is,

$\begin{eqnarray*}f\left(t\right) \ast g\left(t\right) &=& \int^t_0 f\left(x\right) g\left(t - x\right) dx \\ &=& \int^t_0 e^{3x} e^{7\left(t - x\right)} dx \\ &=& \int^t_0 e^{3x} e^{7t} e^{-7x} dx \\ &=& \int^t_0 e^{-4x} e^{7t} dx \\ &=& e^{7t} \int^t_0 e^{-4x} dx \\ &=& e^{7t} \cdot \left.-\frac{1}{4} e^{-4x}\right|^t_0 \\ &=& e^{7t} \left[-\frac{1}{4} e^{-4t} + \frac{1}{4} e^{-4\left(0\right)}\right] \\ &=& e^{7t} \left[-\frac{1}{4} e^{-4t} + \frac{1}{4}\right] \\ &=& -\frac{1}{4} e^{-4t} e^{7t} + \frac{1}{4} e^{7t} \\ &=& \frac{1}{4} \left(e^{7t} - e^{3t}\right) \end{eqnarray*}$

4. Oct 9, 2015

blue_leaf77

To be honest I have never known the definition of convolution you used there. What I know about a convolution between functions $f(x)$ and $g(x)$ is
$$[f(x) \ast g(x)](t) = \int_{-\infty}^{\infty} f(x) g(t-x) dx$$

5. Oct 9, 2015

ecastro

I restricted my function to an extent so that I can compare it with a numerical solution, or this is not the way to compare an analytical and numerical solution?

6. Oct 9, 2015

blue_leaf77

The exponential functions such as those in your example cannot be calculated using computer to begin with. You can try analytically calculate the convolution using the standard definition I wrote in post #4, you will immediately find that the integral diverges at any $t$.

7. Oct 11, 2015

ecastro

How about the $\texttt{exp}$ function?

Is my approach valid if I let my function $f\left(t\right)$ and $g\left(t\right)$ be equal to zero for $t > 1$ and for $t < 0$?

8. Oct 12, 2015

ecastro

In addition, I saw this video:

At the middle of the video, he multiplied the result of the convolution with the value of the time step. He mentioned that it is for the calculation of a continuous time signal result. I don't quite understand why it must be so.