# Phase difference between two sinuisoidal signal

Currently, I have two signals, the main components of both signals are 60Hz, but both also have weaker response at 180Hz + small amount of noise. As shown in the photo below, I want to find the phase difference between the 60Hz component of first signal, and the 180Hz component of the second signal.

As you can see the second waveform of the figure, the phase lagg is of the 180Hz signal is 1.39ms, which coresponds to a 90 degree phase shift.

I am wondering, if I want to implment this phase measurement, could I simply take the fft of two signals, and then find the phase at 60Hz of signal 1, and subtract the phase at 180Hz of signal 2?

Or if there is better way to do so?

You can find phase between 2 sines, if you write it as a complex signal where 1st sine is a real part and second one is imaginary. But to do so it's necessary to rescale one component to fit another in its amplitude variation. Or another approach is to normalize both sines in amplitude value. There are some explanations:

We have signals $s_1(t)$ and $s_2(t)$, which are assumed to be sine waves. Before the measurement of their phase differences, we have to normalize there signals. The normalization process is:

$s^{norm}_i(t) = \frac {s_i(t)} {1.414 \cdot \mathrm{E}[\mid s_i \mid]}$

where $\mathrm{E}[\mid s \mid ]$ is mean value of module of $s(t)$. To perform normalization in real time it's necessary to track $\mathrm{E}[\mid s \mid ]$ constantly since the signal $s(t)$ can be non-stationary. Recurrent moving average filter is the case:

$s^{mean}_i(k) = a \cdot \mid s_i(k) \mid + (1-a) \cdot s^{mean}_i(k-1)$

where $a$ is inverse of integration time (or equivalently filter's length $K$) $a = \frac {1} {K}$ and $k$ sample index in discrete time representation.

Once we normalize both signals it is possible to estimate phase shift between them as

$s(t) = s^{norm}_1(t) + j \cdot s^{norm}_2(t)$

$\phi(t) = arg(s(t))$

$\phi(t) = tan^{-1}(\frac {\Im{s(t)}}{\Re{s(t)}})$

If it's real time implementation good practice is to use CORDIC to calculate the phase instead of $atan$ function.

• Here. They are two signals are different frequency. So that's still ok? Jan 17 '15 at 21:23
• Sure.It will be lineary changing phase.
– Serj
Jan 18 '15 at 7:39