I am trying to find the correlation between the signals $$u(t)$$ and $$\sin(t)[u(t)-u(t-2)]$$

The correlation function $$C(t) = \int^{\infty}_{-\infty} u(\tau+t)\sin(t)(u(t)-u(t-2))d\tau$$

This is my progress so far:

$$u(t+\tau) = 1\rightarrow \tau>-t , 0\rightarrow \text{elsewhere}$$

So for $$t\ge 0$$ the graph looks like this:

But I dont get the correct result , I get something which over time can go above 1.What's wrong with my analysis?

• Hi, welcome to DSP.SE! Are you sure about the limits of your integral? If so, why do you think the output cannot go above $1$? Also what do you think should be the range of your output? Commented Sep 15, 2023 at 21:02
• Your integrand is also wrong. That should be $\sin(\tau) ...$ not $\sin(t) ...$ Commented Sep 16, 2023 at 11:12

OP has the correct idea, but have overlooked some details. Note that both functions have limited support. Then, the correlation is \begin{align} C(t)&=\int_{-\infty}^{\infty} u(\tau+t)\sin(\tau)\big[u(\tau)-u(\tau-2)\big]\,d\tau\\ &=\int_{-\infty}^{\infty} \sin(\tau)\underbrace{u(\tau+t)\big[u(\tau)-u(\tau-2)\big]}_{v(\tau)}\,d\tau\,. \end{align}
This means that the integral limits depend on $$v(\tau)$$ and not only on $$x(\tau)$$ as OP did. We have that $$v(\tau)=u(\tau+t)\big[u(\tau)-u(\tau-2)\big]=\begin{cases}1&\tau\in\big[0,2\big)\text{ and } \tau\geq-t\\0&\text{otherwise}\end{cases}\,\,.$$ In other words, if $$-t\geq2$$, $$v(\tau)=0\,\forall\tau$$. Equivalently, $$v(\tau)=u(\tau+t)\big[u(\tau)-u(\tau-2)\big]=\begin{cases}1&\tau\in[\max\{0,-t\},\max\{2,-t\}\big)\\0&\text{otherwise}\end{cases}\,\,.$$
Now we can substitute the integration limits in $$C(t)$$ and obtain \begin{align} C(t)&=\int_{\max\{0,-t\}}^{\max\{2,-t\}} \sin(\tau)\,d\tau=-\cos(\tau)\bigg|_{\tau=\max\{0,-t\}}^{\tau=\max\{2,-t\}}\\ &=\cos\big(\max\{-t,0\}\big)-\cos\big(\max\{-t,2\}\big)\\ &=\cos\big(\min\{t,0\}\big)-\cos\big(\min\{t,-2\}\big)\,, \end{align} where I use the fact that $$\max\{-x,-y\}=-\min\{x,y\}$$ and that cosine is an even function.
This result can also be rewritten in terms of the step function if required, noting that $$C(t)=\begin{cases}0&t<-2\\\cos(t)-\cos(2)&t\in[-2,0)\\1-\cos(2)&t\geq0\end{cases}$$ Thus, one possible expression (as there are multiple) is $$C(t)=u(t+2)\big[\cos(t)-\cos(2)\big]-u(t)\big[\cos(t)-1\big]\,.$$