Phase Shift Calculation Questions

  • Software
  • Phase Shift Calculation Questions
J M

Posted on 01.07.2021 17:32

Hello,

I need to calculate the phase shift between two signals (accelerometers) at a certain frequency. To verify the method and math functions, I have first started with a simple setup consisting of two signals, sine(125) and sine(125,pi) to create two sine waves at 125 Hz with 180 degree offset. After all my FFT and angular math, I am getting an angular delta of 108 degrees instead of 180 degrees as expected.


I have attached an image of my setup file in addition to the .dxs setup file itself.


I am unsure why I'm getting erroneous results, plotting the angle of the FFT at 125 Hz (either signal) does not look like expected (jagged). Playing with line resolution has not resolved anything either. Any help in this regard would be very appreciated.


Thank you.

Primoz Lapi
Customer Support Engineer
Posted on 05.07.2021 17:03

Hi,


in this article, it is described how to calculate phase shift using correlation mathematics.

https://support.dewesoft.com/en/support/solutions/articles/14000086629-how-to-calculate-the-time-delay-between-two-signals-using-correlation-math


Please let us know if this is helpful.


Best regards,

Primož

Mojca Miklavec
Software Engineer
Posted on 06.07.2021 00:47

Dear J.M.,


You generally cannot really use FFT with df=9,77 Hz to calculate the exact angle at 125 Hz. (Well, if you have a relatively sharp peak as in your sample case, you can still calculate it from the neighbouring bins with relatively straightforward math, just not as simple as the formulas that you used. OK, even that simple formula might still work fine for the difference between two sensors, it's just that the absolute angle value from a single sensor will be somewhat offset.)


You can change the "Resolution" in the dropdown from "Lines" to "Df", and set Df to 5 Hz, so that your peak will have a perfect match with the bin, which will give you the correct result.


One of the problems with your simple example though is that your result interpolates between the values -180 and 180 degrees (measured at cca. 117 and 127 Hz) as if that was a linear function (while in fact both numbers represent almost the same value). One would have to do phase unwrap along the frequency axis first, and only then interpolate the results. This is a problem whenever the result changes the sign (by crossing 180 degrees) between two consecutive samples. In your case the results would also be much closer to the correct value if you first calculated "abs" and only then extracted the value from the array with "{125}".


Mojca

J M

Posted on 06.07.2021 16:03

Primoz, Mojca,


It is very helpful to understand why my setup was incorrect, thank you very much for the detailed reply. I have successfully fixed my math in my simple example setup as well as created a different setup file with the correlation math.

Login to reply to this topic. If you don't have account yet, you can signup for free account .