File Exchange

image thumbnail

Phase Difference Measurement with Matlab

version (1.92 KB) by Hristo Zhivomirov
Phase difference measurement between two signals via DFT.


Updated 01 Oct 2020

View Version History

View License

The present code is a Matlab function that provides a measurement of the phase difference between two signals. The measurement is based on Discrete Fourier Transform (DFT) and Maximum Likelihood (ML) estimation of the signals’ initial phases. The method is highly noise resistive.

An example is given in order to clarify the usage of the function. The input and output arguments are given in the beginning of the code.

The code is based on the theory described in:

[1] M. Sedlacek, M. Krumpholc. “Digital measurement of phase difference – a comparative study of DSP algorithms”. Metrology and Measurement Systems, Vol. XII, No. 4, pp. 427-448, 2005.

[2] M. Sedlacek. “Digital Measurement of Phase Difference of LF Signals A Comparison of DSP Algorithms”. Proceedings of XVII IMEKO World Congress, pp. 639-644, 2003.

Cite As

Hristo Zhivomirov (2021). Phase Difference Measurement with Matlab (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (21)

Sakib Mahmud

Hristo Zhivomirov

Hi, Adilson! Please, try the new improved version of my code. I am sure you will be quite satisfied. However, if you have any troubles, you can get in touch with me and will help you personally. All best, Hristo.

Adilson Batista

I try
x = 127*cos(w*t + pi/6) ;
y = 127*cos(w*t) ;

But don't worked like I expect.


Theodore Wilkening

Sean Wood


Thanks a lot !

Paul Thomas

I have a baseline drift in my second signal and the determined phase shift is reasonable. Nice code!

Mingjian Pan

Thank you for the function, it really save my ass.


Maxime Berger

Mirghani Daffalla

Bryan Mackey

Works great!


Works perfectly. Thank you.

Nice code. Working fine

Sanjoy Basak

really nice code. works perfectly.

guannan li


ronny Wachtel

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!