How to calculate the phase shift AND time delay of non-periodic signals Say I have two non-periodic signals, $f_1(t)$ and $f_2(t)$, with Fourier transforms $F_1(\omega)$ and $F_2(\omega)$. Basically, I need to line up $f_1(t)$ and $f_2(t)$ as close as possible, and I am allowed to shift the signals in time and multiply their Fourier transforms by a constant phase.

What is the most efficient method to find the values of the phase shift $\Delta \phi$ and the time delay $\Delta t$ such that, when the Fourier transform of $f_2$ is modified into

$$ F_2(\omega) e^{i (\Delta \phi + \omega \Delta t)}, $$

the modified $f_2$ best "lines up" with $f_1$ according to their cross-correlation (or some other measurement)?

I am interested in simple and computationally efficient methods, even if they are not necessarily perfect.
A pure time delay could be determined by looking for a peak in the cross correlation. But in your case $f2$ might also have an overall phase offset.

You could try to compute two cross correlations:

$$
\begin{align}
x &amp;= cross(f1,f2) \\
y &amp;= cross(f1,hilbert(f2)) \\
\end{align}
$$

where $hilbert(f2)$ refers to an overall 90° phase shifted version of $f2$. If you combine those two like this

$$ z = \sqrt{x^2 + y^2} $$

you should get something that is independent of the phase shift and shows you a peak at the correct time delay $\Delta t$. The "phase" at that peak, $atan2(y,x)$ should give you the phase offset $\Delta\phi$.

I don't know if such a problem is usually solved this way and I have not tried it myself. But it might work.