Implementing a convolution integral symbolically using integration-by-parts

169 Views Asked by At

I'm working on implementing a convolution integral symbolically (not numerically), to be used in a mathematical modelling tool. This is more of a mathematical problem at this stage, NOT programming. The convolution integral I am working with is truncated at some time $t$ and commences at $t = 0$ and is as follows: $$ (f*g)(t) = \int_0^t{f(t-\tau).g(\tau).d\tau} \ \ [1] $$

I've tried approaching this using integration by parts. However, I appear to be having difficulty since there are clear guidelines on using this for indefinite integrals but I couldn't find much for definite integrals. My approach involved the transformation of the $t - \tau$ term to some other variable $u$ which was then transformed back to $\tau$ without loss of generality.

The integration-by-parts formula is as follows (for any 2 functions $f(t)$ and $g(t)$): $$ \int{f(x).g(x).dx} = f(x).\left[\int{g(x).dx}\right] - \int{f'(x).\left[\int{g(x_1).dx_1}\right].dx} \ \ [2] $$

Then, the worked-out method for a convolution integral should be as follows: $$ \begin{align} (f*g)(t) & = \int_0^t{f(t-\tau)g(\tau).d\tau} \\ & = g(t).\int{f(t-\tau).d\tau} - \int{g'(\tau).\left[\int{f(t-\tau_1).d\tau_1}\right].d\tau} \ \ [3] \\ \\ & If \ we \ apply \ the \ following \ transform: \\ & Let, \ t - \tau = u \ \ [4] \\ & Then, \ d\tau = -du \\ & And \ the \ limits \ become: \\ & @ \ \tau = 0, u = t \\ & @ \ \tau = t, u = 0 \\ \\ & If \ we \ flip \ the \ limits \ to \ ensure \ that \ it \ goes \ from \ 0 \ to \ t,\\ & the \ negative \ sign \ for \ the \ du \ term \ disappears \ i.e., \\ \\ & d\tau = du \\ & And \ the \ transformed \ limits \ become: \\ & @ \ \tau = 0, u = 0 \\ & @ \ \tau = t, u = t \\ \\ & A \ similar \ logic \ is \ used \ for \ the \ inner \ integral \ in \ the \ second \ term \\ & So, \ it \ transforms \ (t - \tau_1) \ to \ a \ new \ variable \ u_1 \\ \\ (f*g)(t) & = g(t).\int{f(u).du} - \int{g'(\tau).\left[\int{f(u_1).du_1}\right].d\tau} \ \ [5] \\ \\ & Assuming \ u \ is \ transformed \ to \ \tau \ without \ loss \ of \ generality, \\ (f*g)(t) & = g(t).\int{f(\tau).d\tau} - \int{g'(\tau).\left[\int{f(\tau_1).d\tau_1}\right].d\tau} \ \ [6] \\ \\ & The \ integral \ of \ f(\tau) \ and f(\tau_1) \\ & is \ essentially \ the \ area \ under \ the \ functions \ w.r.t. \ time \ (t) \\ & So, \ for \ function \ A_f(t) \ that \ defines \ area \ under \ f(t), \\ \\ (f*g)(t) & = g(t).A_f(t) - \int{g'(\tau).A_f(\tau).d\tau} \ \ [7] \\ \end{align} $$

My input functions $f(t)$ and $g(t)$ that I'm using to test this approach are a square pulse and an ascending triangular pulse, respectively. They are as follows: Input functions for convolution

And the result I obtain from this integration-by-parts method is as follows: Integration-by-parts convolution result

This is incorrect, since the actual result should be something along the lines of this image, when I performed convolution in MATLAB (ignore the coordinates since I'm only using this image as reference for the overall shape): MATLAB results of convolution

I'd appreciate it if someone could help me by pointing out where I might have made a mistake or suggesting alternatives to solve convolution integrals symbolically and not numerically.

Have a great day!

1

There are 1 best solutions below

6
On

For

$$f(\tau)=1-\theta(\tau-5)\tag{1}$$

and

$$g(\tau)=\frac{1}{5} (\tau-5)\, (\theta(\tau-5)-\theta(\tau-10))\tag{2}$$

corresponding to the recently updated figures in your question above then

$$h(t)=\frac{1}{10} (t-5)\, ((t-15)\, \theta(t-15)-2 (t-10)\, \theta(t-10)+(t-5)\, \theta(t-5))\tag{3}$$

which is illustrated in Figure (1) below, but I'm not sure I'd consider $h(t)$ a convolution integral since you're using $t$ both as a convolution variable and as an integration limit.


Illustration of formula (3) for h(t)

Figure (1): Illustration of formula (3) for $h(t)$


Note the result illustrated in Figure (1) above is very different than the integration-by-parts method result illustrated in your answer above, but somewhat similar to but not exactly the same as the MATLAB result illustrated in your question above.


If you want to do a variable substitution in conjunction with integration by parts, I suggest you do the variable substitution first and then apply integration by parts as follows:

$$h(t)=\int_0^t g(\tau)\, f(t-\tau)\,d\tau=\int_0^t g(t-u)\, f(u)\,du$$ $$=\left.\left(g(t-u)\, \int f(u)\,du\right)\right|_0^t+\int_0^t \left(\int f(u)\,du\right)\, g'(t-u)\,du\tag{4}$$


In the case of your test functions $f(\tau)$ and $g(\tau)$ defined in formulas (1) and (2) above

$$\left.\left(g(t-u)\, \int f(u)\,du\right)\right|_0^t=0\tag{5}$$

and

$$\int\limits_0^t \left(\int f(u)\,du\right)\, g'(t-u)\,du$$ $$=\frac{1}{10} (t-5)\, ((t-15)\, \theta(t-15)-2 (t-10)\, \theta(t-10)+(t-5)\, \theta(t-5))\tag{6}$$

which leads to

$$h(t)=\frac{1}{10} (t-5)\, ((t-15)\, \theta(t-15)-2 (t-10)\, \theta(t-10)+(t-5)\, \theta(t-5))\tag{7}$$

which is equivalent to the result defined in formula (3) above.