[Math] Solving integral of rectangular function

convolutionsignal processing

I am learning how to calculate convolution of basic signals, such as rectangular ones. Specifically, the definition of such a signal is:

$$
\operatorname{rect}_T (t)=
\begin{cases}
1 & |t|\leq \frac{T}{2} \\
0 & \text{else.}
\end{cases}
\tag{1}
$$

With the definition given, the convolution I am trying to solve is: $s(t)=\operatorname{rect}_{T}(t)*\operatorname{rect}_{2T}(t),$ and here's how far I have managed until now (with $t'$ denoting the dummy integral variable):

$$
\begin{align}
s(t) &= \int_{-\infty}^{\infty} \operatorname{rect}_{T} (t')\operatorname{rect}_{2T}(t-t')dt'\\
&= \int_{-T/2}^{T/2} \operatorname{rect}_{2T}(t-t')dt' \tag{2}\\
\end{align}
$$

where the first rectangular function sets the integral bound and for the remaining integral I figured a change of variable would help: $x=t-t',$ and $dt'=-dx$, and thus the integrand in $(2)$ becomes (following the def. in $(1)$):
$$
\operatorname{rect}_{2T}(x)=
\begin{cases}
1 & \text{if } |x|\leq T \\
0 & \text{else}.
\end{cases}
$$

Substituting back into $(2):$ (mistake fixed: had forgotten to update bounds after change of variable)

$$
\int_{-T/2}^{T/2} \operatorname{rect}_{2T}(t-t')dt'=-\int_{t+T/2}^{t-T/2}\operatorname{rect}_{2T}(x)dx \tag{3}
$$

then re-expressing $\operatorname{rect}_{2T}(x)$ as $\operatorname{rect}_{2T}(x) = u(x+T)-u(x-T)$ where $u(x')=1$ if $x'\ge 0$ and $0$ otherwise. $(3)$ becomes:

$$
\begin{align}
-\int_{t+T/2}^{t-T/2}\operatorname{rect}_{2T}(x)dx &= -\int_{t+T/2}^{t-T/2}\left(u(x+T)-u(x-T)\right)dx \\
&= -\int_{t+T/2}^{t-T/2} u(x+T)dx + \int_{t+T/2}^{t-T/2} u(x-T)dx \tag{5}
\end{align}
$$

  • I don't know if my splitting of the integrals is allowed in $(5)$ and how I should progress with the individual integral calculations. As in, given the bounds of the integral, how do I resolve the cases where the integrand is $1.$ I have e.g. tried another change of variable $y=x+T$ and $dx=dy$, with which e.g. the first integral in rhs of $(5)$ becomes:

$$
-\int_{t+3/2 T}^{t+T/2} u(y) dy \tag{6}
$$

which WolframAlpha solves as:

$$
(6) =
\begin{cases}
0 & t<-3/2 T\\
1 & t\ge -1/2 T \\
t+3/2 & \text{otherwise}.
\end{cases}
$$


But the solution of the convolution $s(t)$ is known to be the function shown below:

enter image description here

  • Edited/updated question: Has my attempt been right upto $(5)$?
  • How can one solve integrals of type $(6)?$ if I can manage this step I'll have solved the original problem. Any hints would be helpful.
  • Last but not least: I feel like this question (convolution) could be solved more efficiently (simply), have I really overcomplicated the whole thing possibly? Again, thanks for any feedback.

Best Answer

Rewriting the given functions in terms of unit step-functions: $$\mathrm{rect}_T(t) = u(t+T/2)-u(t-T/2)$$and $$\mathrm{rect}_{2T}(t) = u(t+T) - u(t-T),$$where $$u(t) = \begin{cases}1, && t\geq 0\\ 0, && t<0\end{cases}$$ Now $$s(t) = \mathrm{rect}_T(t)\star\mathrm{rect}_{2T}(t)$$ $$=[u(t+T/2) - u(t-T/2)]\star[u(t+T)-u(t-T)]$$ $$=u(t+T/2)\star u(t+T) - u(t+T/2)\star u(t-T) - u(t-T/2)\star u(t+T) + u(t-T/2)\star u(t-T)$$ by using the distributive law for convolutions.

Using the property $f(t)\star g(t) = F(t)\implies f(t-t_1)\star g(t-t_2)=F(t-t_1-t_2)$ and the fact that $u(t)\star u(t) = tu(t)$, we get $$s(t) = (t+3T/2)u(t+3T/2)-(t-T/2)u(t-T/2)-(t+T/2)u(t+T/2)+(t-3T/2)u(t-3T/2)$$ Mathematica gives the following result for $s(t)$ for $T=4$: