say I have two signals that are quite "similar" to each other. However, the signals have a (time-varying) shift between each other.
What I would like to extract from the signals is the maximum shift (time) between the two signals... How can I achieve this?
EDIT:
To give a simple example consider the two signals $x(t) = \sin(t)$ and $y(t) = \sin(t - \frac{\pi}{8})$. Here the signal $y$ is delayed by $\frac{pi}{8} \approx 0.4$ seconds with respect to signal $x$.
Now all I have is a measure of the two signals given as a time series like (here the $S$ subscript denotes a sample vector from the original signal):
$$ \begin{split} t_S &= \begin{bmatrix} 0 & 1 & 2 & 3 & 4 & 5 \end{bmatrix}^T \\ x_S &= \begin{bmatrix} 0 & 0.8415 & 0.9093 & 0.1411 & -0.7568 & -0.9589 \end{bmatrix}^T \\ y_S &= \begin{bmatrix} -0.3827 & 0.5707 & 0.9993 & 0.5092 & -0.4491 & -0.9945 \end{bmatrix}^T \,. \end{split} $$
Here, as can be seen, we have a sample time of $\Delta t = 1$ second.
Given only $t_S, x_S$ and $y_S$, I want to recover the maximum shift (which is constant $\approx 0.4$ seconds in this case here) of both signals as "good" as possible.
If I plot both curves, I can estimate the shift "by hand", but I need a programmatical (and more accurate) way.
Call the first signal $x$, and second signal $y$. Then the time T between them is:
$$T=T_x - T_y$$, presuming $T_x >T_y$
The first derivative of $T$ must be equal to zero for maxima/minima. Hence an equation that gives you a formula for all points in terms of $T_x$ and $T_y$ that are maxima / minima.
The second derivative of $T$ must be $< 0$ for a point to be a maximum.