Calculate phase shift between two signals Consider the measurements of two modulated AC signals (voltage and current) which may have noise, harmonics and a DC bias. Each measured signal consists of a list for the time and a list for the corresponding values.

My goal is to find out the phase shift in degrees between these two signals in a robust way.

I would like to realize this in the frequency domain perhaps by calculating and evaluating the fundamental waves of the signals.

Any help or sample code (MATLAB) would be very much appreciated.
Do this procedure on both signals, and subtract the results to get what you want (it would be a nearly constant sequence whose value is phase shift in radians)


Perform FFT on the signal to obtain its spectrum.
Find the dominant harmonic of the signal : $f_c$ (where the peak of FFT occurs).
Filter the signal with a narrow-band linear phase filter (center = $f_c$, bandwidth as less as possible).
Again, perform FFT on the signal and extract its phase.


Note : It is assumed that the signal has a dominant frequency otherwise a phase shift is pointless