0
$\begingroup$

This is probably a really basic question but I'm a little stumped and would appreciate some practical input on how to go about doing this rather than reading dockets of equations semi-related to what I am doing.

So say I have data which is largely reminiscent of a sine wave. I do an forward Fourier transform and low pass filter it to remove some noise. Is it possible to then find the phase or shift of the remaining sine wave with the transformed data in the frequency domain before performing the inverse transform?

I did some reading and it looks like the phase shift information is stored in the imaginary part of the transform?

I've written two algorithms for finding the phase shift in the time domain, but they are clunky and unfortunately unreliable. Any help would be appreciated.

Also, I'm not specifically asking for the answer but keywords to research, or places to find information would be highly appreciated.

$\endgroup$
  • $\begingroup$ So I've done some more reading and it looks like I need to take the arc tangent of the imaginary component of interest over the real. Does this sound about right? $\endgroup$ – CaseyK May 26 '15 at 5:28
  • $\begingroup$ Yes it sounds about right. You probably have an atan2 function available in the programming language. It takes two arguments and will help avoid division by zero for angles close to pi/2 and -pi/2. Do you know the frequency beforehand or should you seek for it (maybe even from between the frequency bins)? $\endgroup$ – Olli Niemitalo May 26 '15 at 6:57
  • $\begingroup$ Thanks Olli. I know roughly the frequency of interest, it should be very close to 0Hz. So I can try to find that frequency by it's peak height in the freq domain, then do the atan2 thing to get the phase. I'm going to give this a shot. $\endgroup$ – CaseyK May 26 '15 at 14:30
  • $\begingroup$ So I gave it a shot using Atan2 (imag,real) and took a peek at every single 'phase angle' in my sample. Unfortunately none of them correspond even closely with the phase I can see on the graph or approximate through other means. I'm not sure why this is. Is it possible that my FFT decomposed my sine function into two or more harmonics? $\endgroup$ – CaseyK May 26 '15 at 17:05
  • $\begingroup$ Yes, in which case you need to interpolate between the bins to find it. $\endgroup$ – Olli Niemitalo Jun 4 '15 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.