Only data, no BS.

Measurement of phase between two signals is often required when using oscilloscope. Some scopes have built-in function for that, some do not. One could accomplish task with cursors, but this is time consuming and not ultimately accurate. Alternative is to use math formula. For example in PicoScope community following formula is circulated:

(acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180)

Formula is based on integration and is principally functional, but due to various technical nuances often does not work or displays completely wrong value, as demonstrated on screenshot above (orange trace, DC average over oldPhase(A;B) measurement). Main culprit is time it takes for integrated trace to "settle".

**Substantially improved result** can be obtained with formula operating on entirely different principle of trignometrical discretization. Condition is that signals have equal duty cycles at zero crossing. Duty itself may differ from 50%. Consequently works with pulses of equal length. Pulses must overlap. Within these limitations waveform of any shape and amplitude is first converted to square wave of "standardized" amplitude (inside formula). Then phase diff is obtained via simple arithmetics for two square waves (indigo trace, DC average over newPhase(A;B) measurement).

((((atan(1/tan(pi*(A/10000)))/pi)+(A/10000))*-((atan(1/tan(pi*(B/10000)))/pi)+(B/10000)))+0.25)/0.002777777

#### Contact lab!fyi

Results obtained with different methods on input of ChA: 10kHz, 0dBm triangle. ChB: 10kHz, -10dBm square:

Input | 40° |

newPhase(A;B) | 39.86° |

Cursors | 37.54° |

oldPhase(A;B) | 55.84° |

As seen new formula demonstrates accuracy unobtainable even by cursor measurement. Note that when phase diff is over 180° it starts to diminsh again with both formulas and reaches 0° by 360°.

Tests were conducted on PicoScope 6 - PC Oscilloscope software version: 6.12.9.2917, PicoScope 2408B hardware. Signal generator was Siglent SDG2122X.

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.