Phase difference measurement of a signal sampled with two different sampling frequencies

I am working on phase interferometry for locating a transmitter. The direction of arrival of an incident wave can be estimated from the phase difference caused by the antenna separation as shown In order to compute the relative phase difference between an incident wave at both receivers, their sampling rate should be the same and both receivers should be phase-matched. In my case, the sampling frequencies on both receivers are different. The phase difference computed in this scenario will be.

$$\quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \Delta\phi = \phi_o + \Delta \omega t$$

where $$\phi_o$$ is the initial phase, $$\Delta \omega$$ is the angular frequency difference between the two sampled signals due to different sampling frequencies and $$t$$ is the time instant.

It is clear that the phase difference will vary with time and frequency. The sampling frequencies for both the receivers are $$737MHz$$ and $$631MHz$$. I am using 256pts complex FFT for phase computation.

Is there any single shot solution for comparing the relative phase difference between the signals received with different sampling frequencies as mentioned?

• Are the two receivers phase-locked to each other? Nov 29 '19 at 14:36
• no not really, there really isn’t a simple solution. If your sample rates are related by an integer multiple and feed off a common time reference, it would be better
– user28715
Nov 29 '19 at 16:11
• The two receivers don't need to be phase locked, per se, but they do need to have a common phase or time reference of some sort. Is there anything that'll let you synchronize the capture, or otherwise cause the timing between the receivers to be known? Nov 29 '19 at 16:48

This is an untested time domain solution, but the math looks solid.

This will be impossible to implement unless you solve the reciever synchronization problem first. That is either a hardware fix or a calibration operation. Assume it is solved and your two signals are coming in as time aligned sequences. Assume also your sampling rates (I don't like "sampling frequency" as a term) are high compared to the frequency of the incoming signal. Also the incoming signal is assumed to be a pure real tone of a known frequency ($$\omega$$).

You will be searching for peak values on each sequence. Use a parabolic fit with the center point being the max. You will then need to find the signal values from the sequences at that time instance by interpolation.

Another problem you will have is normalizing the magnitude of one signal against the other. This solution does that implicitly.

With that in mind, we can do the math with a continuous definition.

$$x_1(t) = A_1 \cos( \omega t + \phi )$$

\begin{aligned} x_2(t) &= A_2 \cos( \omega ( t - d ) + \phi ) \\ &= A_2 \left[ \cos( \omega t + \phi ) \cos( \omega d ) + \sin( \omega t + \phi ) \sin( \omega d ) \right] \\ \end{aligned}

Divide the second signal by the first.

$$\frac{x_2(t)}{x_1(t)} = \frac{A_2}{A_1} \left[ \cos( \omega d ) + \tan( \omega t + \phi ) \sin( \omega d ) \right]$$

At a peak of signal 1, $$\tan( \omega t + \phi ) = 0$$, since the $$\sin$$ does which is the derivative.

$$(\frac{x_2}{x_1})_{peak1} = \frac{A_2}{A_1} \cos( \omega d )$$

By symmetry the reverse argument can be made.

$$s = t - d$$

$$x_2(s) = A_2 \cos( \omega s + \phi )$$

\begin{aligned} x_1(s) &= A_1 \cos( \omega ( s + d ) + \phi ) \\ &= A_1 \left[ \cos( \omega s + \phi ) \cos( \omega d ) - \sin( \omega s + \phi ) \sin( \omega d ) \right] \\ \end{aligned}

$$\frac{x_1(s)}{x_2(s)} = \frac{A_1}{A_2} \left[ \cos( \omega d ) - \tan( \omega s + \phi ) \sin( \omega d ) \right]$$

$$\tan( \omega s + \phi )$$ will be zero at a peak of signal 2.

$$(\frac{x_1}{x_2})_{peak2} = \frac{A_1}{A_2} \cos( \omega d )$$

We can now combine the ratios from the two different peak locations:

$$\cos( \omega d ) = \sqrt{ (\frac{x_2}{x_1})_{peak1} \cdot (\frac{x_1}{x_2})_{peak2} } = V$$

Since we are squaring, the sign of $$V$$ is lost. It can be deduced from the individual parts.

$$d = \frac{ \cos^{-1} (V) }{ \omega }$$

Note, the solution is not unique as the shift can be greater than one cycle length.

This should take a lot fewer calculations than an FFT approach.

If you can measure the peaks directly, then $$d$$ is simply their distance apart plus possibly a number of whole cycles.

You can calibrate your system if you can move your source straight ahead for a baseline shift measurement, ideally zero. Then a measurement the same distance on either side will give you an idea of the angle of the first cycle overlap if there is one.

For a third solution, there is a simple frequency domain approach that will work well in this situation if your signal is too noisy for the time domain one. Select a duration which is a whole number of cycles, say $$k$$, of the signal you are receiving. It will be roughly $$M$$ number of samples at your one rate and $$N$$ on the second. Calculate the $$k$$th DFT bin for each using two sets of basis vectors (two different DFTs, technically, but one bin each). You should be able to find an interval so the $$M$$ and $$N$$ are pretty good fits. Read the phase difference from the difference of the two bin angles. Translate that to a time shift using the frequency. This should still take a significantly fewer number of calculations than doing FFTs (DFTs) on each signal.

• Thank you so much for your detailed answer, It works. Dec 3 '19 at 11:38
• @SalmanShah Thanks for letting me know. See my answer for yet a third solution. Whcih did you use? It would also be nice if you added a little bit of a follow up with some details. Were you able to calibrate? Dec 3 '19 at 19:36
• @SalmanShah You can find a Python code example, with a tweak here: dsp.stackexchange.com/questions/63074/… The first paragraph references back to this answer. It is the same question Dan B. is referencing in his answer. These two questions are awefully similar. BTW, which approach worked? Jan 11 '20 at 15:31

Is there any single shot solution for comparing the relative phase difference between the signals received with different sampling frequencies as mentioned?

Yes it is, as long as you have an exact knowledge of the timing relationship between the samples for each receiver. It's complicated, but if you understand the properties of the Fourier transform it's only complicated in the fact that you need to do a lot of book keeping, not that you have to solve weird math problems.

If you have a tone, and you sample it, then window it and take the FFT of the windowed sample, then the result is that one or more bins of the FFT will show energy, and will have phase measurements. Because you've windowed it, the phase measurement will be most accurate with respect to the center of the window, not the starting or ending points in the sample.

That phase with respect to the center of the window indicates the timing of that signal with respect to the center of the window. So you can figure out the phase in radians, correct it by $$n \pi$$ where $$n$$ is the bin number (because you're looking at the center of the window), and then calculate the time offset as phase/frequency with everything in radians and radians/second.

Do this for both receivers. Then correct the arrival times by the known time offset between the two windows (because you're sampling at different rates). At this point you should have a time offset; you can then use the known dimensions of the antenna, and the speed of light, to calculate the angle of arrival.

If your signal is at least somewhat oversampled, you could try the following time domain approach; 1) Apply the output of each A/D to a Hilbert Transform filter to generate a complex signal. 2) Derive the sample-by-sample angle for each complex signal by using ATAN2. 3) Designate 1 channel as the reference channel. For every reference clock and subsequent angle calc, sample the other channel's most recent calculated angle. Subtract the two angles. 4) Since the A/D's were not clocked synchronously, there will be an error in every single-shot delta-angle calculation. Remove this error by averaging many delta-angles together. 5) There may be a bias in this technique that could be removed by alternating which channel is defined as the "reference".

Note; my confidence in this answer is not terribly high!

Bottom Line

$$(\theta_2-\theta_1) = 2\pi f(T_2-T_1)n -(\phi_2[n]-\phi_1[n]) \tag{1}$$

$$f$$: frequency in Hz of two tones of the same frequency and fixed phase offset

$$(\theta_2-\theta_1)$$: phase difference in radians of tones being sampled

$$T_1$$: period of sampling clock 1 with sampling rate $$f_{s1}$$ in seconds

$$T_2$$: period of sampling clock 2 with sampling rate $$f_{s1}$$ in seconds

$$\phi_1[n]$$: phase result from sampling tone with $$f_{s1}$$ in radians/sample

$$\phi_2[n]$$: phase result from sampling tone with $$f_{s2}$$ in radians/sample

This shows how any standard approach of finding the phase between two tones of the same frequency that are sampled with the same sampling rate (common phase detectors approaches including multiplication, correlation etc) can be extended to handle the case when the two sampling rates are different.

Simple explanation:

Consider the exponential frequency form of equation (1):

$$e^{j(\theta_2-\theta_1)} = e^{j2\pi f(T_2-T_1)n}e^{-j(\phi_2[n]-\phi_1[n])} \tag{2}$$

The term $$e^{j2\pi f(T_2-T_1)n}$$ is the predicted difference in frequency between the two tones that would result from sampling a single tone with two different sampling rates (when observing both on the same normalized frequency scale).

The observed difference in frequency between the two tones would be $$e^{j(\phi_2[n]-\phi_1[n])}$$.

Both terms have the same frequency with a fixed phase offset. This phase offset is to the actual difference in phase between the two continuous-time tones. By conjugate multiplication we subtract the two, removing the phase slope and the fixed phase difference results.

For full derivation see this post with the same question: Phase difference between signals sampled at different frequencies