# Measure phase difference using correlation

Measuring the phase difference between two periodical signals is often required for a science such as meteorology, computing, and communications. An oscilloscope offers a quick and simple way to make such measurements. Unfortunately, an oscilloscope’s noise, bandwidth, and timing resolution limit its measurement accuracy.

The oscilloscope’s sampling rate sets its timing resolution. For example for a 100 MHz signal, each degree in phase translates into 27 ps. Clearly, for a one-degree phase measurement accuracy, the sampling time of the oscilloscope must be less than this number. That translates into a sampling rate higher than 36 GHz, which is beyond the reach of the majority of oscilloscopes. To demonstrate this measurement we used an Analog Arts SA985 USB oscilloscope, which has a sampling rate of 100 GHz and a bandwidth of 1 GHz. You can perform this measurement with any oscilloscope that meets the timing requirements of your application. Even with the proper oscilloscope, you must use special techniques to get accurate phase measurements.

An oscilloscope’s timing markers (Figure 1) offer the simplest technique to measure the phase between two signals. The time difference between two corresponding points on the signals represents the phase in units of time. Multiplying the ratio of this value to the period of the signals calculates the phase in degrees. The precision of the measurement is highly dependent on the oscilloscope’s noise and the triggering uncertainties.

**Figure 1. Using timer markers let you measure the phase difference between two signals.**

Traditionally, Lissajous patterns (Figure 2) have been used to measure the phase between two sine waves. Making precise measurements from Lissajous plots is, however, simply not possible. Furthermore, for signals other than sine-waves, these patterns are difficult to interpret.

**Figure 2. A basic Lissajous Pattern for measuring the pahse difference between two sine waves.**

Performing mathematical operations on the signals can enhance the phase measurement. Techniques described in references 1, 2, and 3 are some examples of such operations. Although each method might be suitable for certain applications, the measurements suffer from several factors beyond the scope of this article. In addition, these techniques are mostly for sinusoidal signals. In applications such as measuring the phase performance of the various PLL generated clocks inside an FPGA, they are markedly inaccurate.

A simple and accurate method is to correlate the signals. Correlation is a straight-forward mathematical operation. Numerous papers (Ref. 4) thoroughly explain its operation as well as its applications. A C# algorithm, developed by Analog Arts, is one implementation of this technique. Figure 3 shows the phase difference between two 200 MHz sine waves obtained by this algorithm.

**Figure 3. Correlation lets you calculate phase difference between two signals.**

A key advantage of correlation is its ability to find the phase difference between most other types of signals. Figure 4 shows the phase difference between a sine wave and a square wave. In addition, issues such as the DC content of the signals, noise, and triggering problems have insignificant effect on the result. For applications where the signal noise becomes a dominant factor, averaging can be used to reduce its effect.

**Figure 4. Phase difference between a sine wave and a square wave using correlation.**

The accuracy, which can be obtained by this technique, is mainly limited by the relative accuracy of the period of the signals and the sampling rate of the oscilloscope. For a signal sampling rate of 100 GHz and a relative frequency accuracy of .01 ppm, phase measurements of better than .5 degrees can be expected. Signal averaging can further enhance the accuracy of the measurements to .1 degree.

Correlation proves to be beneficial in real world applications where issues such as, ringing, reflection, and rise-time mismatch between the signals severely limit other phase measurement techniques.

**References**

- G. Huang, L.R. Doolittle, J.W. Staples, R. Wilcox, J.M. Byrd, Signal Processing for High Precision Phase Measurements
- Measuring relative phase between two waveforms using an oscilloscope
- Peter O’Shea, Phase Measurement
- Correlation functions and their application for the analysis of MD results