# UPDATE : How to continue Computing the Convolution

$$x(t):=\begin{cases} 1&\text{if 0 Compute $$(x*h)(t)$$.

My approach: We first note that :$$\displaystyle x(\tau)=\begin{cases} 1&\text{if 0<\tau We observe that : $$0<\tau $$t-2T<\tau Thus, $$(x*h)(t)\in\mathcal{R}[\max(0,t-2T),\min(t,T)]$$ (i.e. Riemann integrable). Therefore : \begin{align*} (x*h)(t)&:=\int_{-\infty}^{\infty}x(\tau)h(t-\tau)\;\text{d}\tau\\ &=\int_{\max(0,t-2T)}^{\min(t,T)}t-\tau\;\text{d}\tau\\ &=\left. t\tau-\frac{\tau^{2}}{2}\right|_{\max(0,t-2T)}^{\min(t,T)}\\ &=\left[t\min(t,T)-\frac{\min^{2}(t,T)}{2}\right]-\left[t\max(0,t-2T)-\frac{\max^{2}(0,t-2T)}{2}\right]\\ &=t[\min(t,T)-\max(0,t-2T)]-\frac{1}{2}[\text{min}^{2}(t,T)-\text{max}^{2}(0,t-2T)] \end{align*}

Problem: I want to further solve this to obtain the final solution as a piecewise function (if it has such form)

I present to you the MATLAB simulation of the convolution

First one corresponds to $$T=1$$ and the second one corresponds to $$T=2$$. Here is the algorithm used:

t = linspace(0,10,1000);   % assume a time span for "t"
T=1;
m = min(t,T);              % find min of (t-1 , 5) for each "t"
M = max(0,t-2*T);            % find max of (t-3 , 3) for each "t"
vind = M < m;              % find "valid" range of "t"

y = t.*(m-M)-0.5*(m.^2-M.^2);% EVALUATE the CONVOLUTION
y = y.*vind;               % force non-valid range to zero.

figure,plot(t,y);         % DISPLAY:
title('convolution is :');


Credits to $$\text{@Fat32}$$ for the code in his answer in the link provided in the comment

• Hi! this link provides a solution to almost the same problem. Mar 2 at 12:44
• No there's just one more step before plotting the graph, and it's in the answer. Mar 2 at 13:36
• Sorry, your Matlab appears to be wrong. The length of $x$ is $T$ and the length of $h$ is $2T$ . That means that the length of the convolution cannot exceed $3T$. You didn't label your axis in T, so you probably assumed an example value for it. Mar 2 at 23:25
• Use T=1 and post your code. Mar 2 at 23:34
• Your code sets the lower bound to $max(0,t-T)$ should be $max(0,t-2T)$ Mar 2 at 23:46

Some general hints for this type of problem

1. If the function is defined piecewise than chances are your calculation and solution will also have to be done piecewise in sections.
2. Determine first where the result is zero, i.e. where $$x(\tau)$$ and $$h(t-\tau)$$ don't overlap. This determines the start and end of the sections that you need to consider. Hint: if both functions are causal than $$t=0$$ is always a boundary. The length of a convolution is always equal (or smaller) than the sum of the lengths of the signals.
3. Then find the section boundaries: these are where the mins() and maxes() changes from one argument to the other.
4. In each section replace the max()/min() with the correct value for this section. Solve each section individually and splice the solutions together.

It's also super helpful if you can develop some graphical intuition for this type of problem: draw both functions with a few different overlaps and see what happens when they start overlapping, when they are fully overlap and when they stop overlapping.

You already came a long way. Give that a shot and post back if you are still stuck. Happy to help more.

EDIT More help on the piecewise solution. For simplicity let's call the convolution $$y(t)$$

1. $$y(t)$$ must be zero for $$t < 0$$. The convolution cannot start earlier than any of the signals
2. $$y(t)$$ must be zero for $$t > 3T$$. The convolution cannot be longer than the sum of the length of the signal.
3. That means you only need to focus on the interval $$0 < t < 3t$$
4. $$min(t,T)$$ is $$t$$ for $$0 < t < T$$ and $$T$$ for $$T < t < 3T$$
5. $$max(0,t-2T)$$ is $$0$$ for $$0 < t < 2T$$ and $$t-2T$$ for $$2T < t < 3T$$

That means that you need to split the solution into three section: $$[0,T]$$, $$[T,2T]$$ and $$[2T, 3T]$$. Within each section, you can replace the min/max functions by the actual value since it doesn't change over the section. Example: in the first section $$[0,T]$$, we have $$max(0,t-2T) = 0$$ and $$min(t,T)=t$$ so you would be integrating over $$[0,t]$$.

• Hello!, thank you for your amazing advice, graphically I noticed that the area under the graph of $x(\tau)$ and $h(t-\tau)$ is the area of a triangle equal to 1 starting $t=0^{+}$. But this seems like its the only case since as $t\to\infty$ such that $t<T$ the area is still $1$. Mar 2 at 14:34
• but here $h(t)=t$ if $0<t<2T$ I am not aware that it is a rectangle. Mar 2 at 15:55
• Yikes. My bad and I deleted my commet, I misread this as "1" and not "t". So yes, it's a little more complicated and the graphical interpretation is not as easy as I though. But the rest of the method still should work fine and the graph is still a good way to detrermine the segments Mar 2 at 19:44
• Hello again, I have tried to apply the strategy you mentioned, I started by picking negative values of $t$ then slowly monitoring any changes as $t$ increases but this has proven to be even more complicated. Is it possible in this case to solve it without graphing? I hope you can help me in concluding the answer :) Mar 2 at 21:44
• Alright thank you very much I will definitely be able to continue from here :) Mar 2 at 23:55