IFFT Frequency & Phase Extraction

Hello, I'm relatively new to Igor (v6.0) and signal processing, and am stuck with the IFFT and extracting the phase of a wave.

I've got some data in the time domain, which I need to determine the phase for, and I expect to see a flip in the phase FFT (which I'd like to measure) when a change in phase occurs in the signal. Unfortunately the signal is quite messy in that there's a fair amount of beating and the phase is also not constant throughout the wave.

So the approach I'm trying to take is:
1) Since I have a separate time domain x and y wave, interpolate the two to form one wave.
2) Take the complex FFT of that single wave.
3) Isolate the region of data I'm interested in, in the FFT and duplicate that region of interest into a new wave
4) Then perform an IFFT on that subset of frequency data to convert it back into the time domain to obtain a clean signal
5) Then perform a phase FFT on the clean time domain data to extract the phase behaviour of that region

For the moment I've decided to test that procedure using a simpler simulated wave, to understand what's happening a bit better.
I've created a superposition of two waves, one at 2Hz, the other at 4Hz and phase shifted from the 2Hz wave by 45degrees.
But I'm stuck at steps 3-4, reconstructing the wave back from the FFT data (see attached picture).

The FFT of the wave (in the top right hand corner seems to make sense)
But when I try to duplicate a small region of that FFT wave, say between 0-3Hz (to pick out the 2Hz peak on the left), the resulting wave (middle right) doesn't seem to make much sense, in that the amplitude is huge plus I've noticed that in the wave data itself, it's missing the imaginary component...? So I'm not too sure what's happening here.
Next when I run the IFFT on that extracted wave, it returns back the selected region of the fourier space data, rather than the reconstructed time domain signal. So maybe it seems like the duplicate functon somehow took out the time signal rather than the frequency domain signal?

I'm rather confused and am not too sure where I went wrong. I've read the igor manual, but am not sure if there's a better way to approach this. Any help on being able to extract a clean signal from the complex FFT peak would be much appreciated!
I've also attached my procedure file, as i've created a series of simple functions to do this.

Also a secondary question - is it possible to address the individual component waves of the imaginary wave? namely "wavename.d.real" & "wavename.d.imag", I've tried addressing them as individual waves but that didn't work...

Best regards,
Denigmaz.
PS: If anyone has a better, more efficient way to approach the entire problem I'm interested to hear some other ideas.

igorExch_IFFT_Phase_Help.ipf (2.13 KB)
Hello Denigmaz,

Thanks for sending your experiment to support@wavemetrics.com. We include our response here for the benefit of the readers of the Igor Exchange.

It is not clear from your statements if you need to measure phase of the signal or phase of the transform. It is also not clear if your application has a known (deterministic) signal or reference.

Step (1) makes sense only if the sampling of the original y wave is not at constant intervals. In your simulated example there is no real need or use for the X wave or for interpolation. In a practical application if your data are not sampled at equal intervals you might also want to consider using the LombPeriodogram which directly supports uneven intervals.

Step (2) taking the complex FFT makes sense however I should caution you that the way you chose to display the result in a graph is bad. Specifically, you displayed the the complex wave using the "real and imaginary" mode. While this mode is provided by IGOR it is not helpful here. In displaying complex data it is more useful to choose one of the two pairs, i.e., display a trace for the real part of the wave and a trace for the imaginary part or a trace for the magnitude and a trace for the phase. Other choices are less intuitive.

Step (3)
It sounds as if this "isolation" is intended to act as filtering. The trouble with your approach is that by changing the number of points in the wave you are messing up the normalization so the inverse FFT is not going to produce the correct magnitude of the wave. Instead, keep the original wave size and zero both the real and imaginary part for spectral components that you want to filter out. Note also that simply setting components to zero is equivalent to applying a very sharp filter so don't be surprised if the inverse transform shows this. At this step it helps to remember that the transform of a product of functions is the convolution of the respective transforms...

Steps (4) and (5)
These will depend on correct implementation of (3) above.

If you are trying to find a phase change in your signal as a function of time you might want to provide some information on the nature of your signal. If it is mostly a known signal you could implement some sort of a matched filter or use quadrature tricks to extract the phase as a function of time. If your signal is not deterministic then you could break your time data into a number of intervals, evaluate the complex FFT for each interval and compare the phases (on a frequency by frequency basis) to detect changes.

Another approach that might be useful for you is the application of either the Wigner Transform or the CWT. If you check the Wigner Demo Experiment (File Menu->Example Experiments->Analysis->Wigner Demo) you can choose from the panel the Two Frequencies example and observe the effect of phase and frequency changes on the transform.

The last resource that comes to mind for this application is available right here on the Exchange http://www.igorexchange.com/node/409.

I hope this helps,

A.G.
WaveMetrics, Inc.





Hi A.G.,

Thanks for the reply. I zeroed the rest of the data and was able to do the reconstruction fine.

But now I'm stuck on doing a phase FFT on the reconstructed time domain signal. I've taken a straight phase FFT of the data (manually scaled the endpoints so the wave is repeatable as I could get it) but it's a bit all over the shop with a number of artefacts in it (see picture below)....
- thought I'd try the simple approach first...

eg. shouldn't the dotted blue reconstructed 2Hz trace line up with the full blue trace (ie. the original 2Hz)? Instead it does a strange dip at the 2Hz point and ontop of that seems tos flip at 3.5hz where it shouldn't be.

Though the phase FFTs of the original signal seem to be ok, ie. the green trace is ~45deg off from the blue as expected (from the +/-90deg or +/- 1.57rads reference point)

Is there a way to get around / correct for the artefacts in the phase of the reconstructed data? The reconstructed time domain signal is close to the original but not 100% there (there's a very slight envelope over it).

Denigmaz.
igorExch_IFFT_Phase_Help_2.png (142.13 KB)
Denigmaz,

You are still not really answering the questions posed to you in my first response so I can only guess what you are attempting to do.

Before you begin to investigate the phase of the various transforms it is important to remember how the phase is computed. When using /Out=5 the phase is computed using atan2(imaginary,real). This means that the results are modulo 2*pi and should really be unwrapped (see the documentation for the Unwrap operation). When your input to the FFT is real valued, the first element of the transform is real (dc term) and the computed phase of this first point should be ignored.

The next issue that you need to remember is that you are comparing the phase of a reconstruction with the phase of the original signal. If the reconstruction is not identical to the original signal (as you can see by plotting them both on the same graph or computing the integrated difference), then it is not unreasonable expect a a difference in phases. Furthermore, since the signals considered have transforms that are sharply peaked (essentially delta functions) then computing phases using atan2() is less than ideal (i.e., numerically unstable) for frequencies sufficiently removed from the peak.

As I said earlier, it would be helpful to have a concise statement of the problem; otherwise we can only try and explain the effects that you describe.

A.G.
WaveMetrics, Inc.
Quote:
It is not clear from your statements if you need to measure phase of the signal or phase of the transform. It is also not clear if your application has a known (deterministic) signal or reference.


Ah sorry about that:-
* I need to measure the phase of the time domain signal, not the transform.
* There is no deterministic signal or absolute reference per se, but one of the waves can be potentially used as a relative reference signal against which to measure the relative phases of the other traces.
Hi A.G.,

I'll start again, this time with the problem rather than partway through a potential solution, sorry about being unclear.

I've got a number of datasets with non-uniform signals, and I would like to measure the phase change of the signal over time, for every signal. And eventually generate a plot of phase (in degrees) vs time for each signal.
One of the waves in the dataset can be treated as a reference signal against which to the measure the change in phase for the other signals.

The nature of the signals are sinusoidal, and there is more than one frequency in them. Moreover they appear to change in phase over time. There is also a steep envelop over the raw signal.

What is the best way to go about this?

I've taken a look at the Wigner Demo, and that's good for displaying the evolution of frequency and power of the signal over time, but I can't directly see how the phase is changing from the resulting Wigner image...(?)

And you also mentioned there were some quadrature tricks, could any of those be used to generate a phase vs time plot?

Denigmaz