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.

  • 1
    $\begingroup$ By "phase shift" do you really mean "time shift"? $\endgroup$
    – Jim Clay
    Commented Sep 13, 2013 at 18:21
  • $\begingroup$ I mean the phase shifting between current and voltage. E.g.: In the case of a capacitor, the current leads the voltage by 90 degrees. I want to calculate that 90 degrees. $\endgroup$
    – lR8n6i
    Commented Sep 14, 2013 at 11:56
  • $\begingroup$ correct. filtering does nothing for the accuracy. accuracy is improved by using a longer fft, not filtering. $\endgroup$
    – Jerry
    Commented Oct 2, 2013 at 23:42

1 Answer 1


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)

  1. Perform FFT on the signal to obtain its spectrum.

  2. Find the dominant harmonic of the signal : $f_c$ (where the peak of FFT occurs).

  3. Filter the signal with a narrow-band linear phase filter (center = $f_c$, bandwidth as less as possible).

  4. 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

  • $\begingroup$ Hi! Thank you for your response. I could accomplish 1 and 2. Could you maybe recommend a suitable filter type for task 3? Do you think a linear phase filter should be used? $\endgroup$
    – lR8n6i
    Commented Sep 13, 2013 at 14:40
  • $\begingroup$ My knowledge is not enough to recommend you a suitable filter type. You can try most important ones, and choose one that works well. Yes the filter must be a linear, otherwise it will distort the phase of the inputs. $\endgroup$ Commented Sep 13, 2013 at 16:05
  • $\begingroup$ Why don't you just read the phases from the FFT bins? What's the filter for? $\endgroup$
    – endolith
    Commented Sep 14, 2013 at 3:40
  • $\begingroup$ @endolith the filter is arbitrary and its usage depends on the level of the noise. $\endgroup$ Commented Sep 14, 2013 at 6:12
  • $\begingroup$ @MahdiKhosravi: but what does it do? what is its purpose? the peak bin will be the same before and after the filter $\endgroup$
    – endolith
    Commented Sep 14, 2013 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.