The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 FFT Phase Angle

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
rrwoods Posted - 06/18/2004 : 12:26:26 PM
Hello all...

I'm relatively new to Origin. I've been using the FFT tool, and I noticed that the Phase Angel, when it isn't wrapped, takes on values as low as -900 and as high as +900 degrees. How are these values chosen? I read somewhere that it has to do with the sign changes in the Real and Imaginary data, but I didn't see any correlation. It doesn't make sense for the values to spread over an area that is wider than 360 degrees.

Edited by - rrwoods on 06/18/2004 4:06:39 PM
11   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 06/25/2004 : 12:26:32 PM
Easwar's plot looks much more promising than I would have imagined and it would be a shame to abandon your efforts at this point. You can achieve the same thing in Origin 6.0 with a modified version of the script Easwar gave earlier.

1. Open Custom.ogs (in Origin's program folder) in Notepad and edit the [Main] section to look like this...

[Main]
//type -b $General.Userbutton;
phPrev = 0;
phCum = 0;
for(i=1;i<=512;i++)
{
phNew = %C[i];
delta = phNew-phPrev;
phPrev = phNew;
if(delta > 180)
delta = delta - 360;
else
{
if(delta < -180)
delta = delta + 360;
}
phCur = delta + phCum;
phCum = phCur;
%C[i] = phCur;
};
lay -a;
# End of [Main] script.

2. Perform your FFT without unwrapping the phase.

3. Make sure layer 2 of your FFT plot is active (click the 2 icon in top left corner).

4. Click the Custom Routine button on the standard toolbar.

Now your phase plot should look like Easwar's.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 06/25/2004 2:02:20 PM
rrwoods Posted - 06/25/2004 : 11:59:11 AM
...

One word: WOW.

Unfortunately, the high-up people in charge of ordering software here where I work don't see a reason to have a newer version of Origin -- or any version at all, for that matter -- so we won't be getting 7.5 anytime soon. I think I will try the demo at home though, just to play around with it.

I've abandoned using the phase data in trying to eliminate noise for now. I may come back to it later if what I'm trying now doesn't work. I appreciate all the help you guys have provided.
easwar Posted - 06/24/2004 : 11:00:32 AM
Hello,

Thank you for sending in the OPJ. I took the data in your OPJ and performed an FFT in version 7.5 and the result is as below:


So you can see that the unwrapped phase plot is a lot "cleaner". In version 6.0 unwrapping was not done correctly and this was improved in later versions.

Now, the phase plot does show a change around 8kHz as you indicated. But I am not sure if it is possible to analyze the phase plot shape change to determine where your true signal frequency is - you need to look into some signal processing text book to see if that is a reliable technique.

As for the algorithm we use for unwrapping, the internal code does what I posted in form of script earlier. You can download the 7.5 demo to try this yourself.

Easwar
OriginLab

easwar Posted - 06/22/2004 : 3:21:17 PM
Hi,

Can you please send in your OPJ or the data from your sound file, to tech@originlab.com so that we can take a look at how the phase data looks like etc?

Please state in your e-mail that you are following up on this forum post.

Thanks,

Easwar
OriginLab


Mike Buess Posted - 06/22/2004 : 11:58:56 AM
But I don't see how you can expect the phase plot to be any better.

Mike Buess
Origin WebRing Member
rrwoods Posted - 06/22/2004 : 11:54:35 AM
I agree that the amplitude data would be much more useful, if my amplitude graphs looked like the one you posted -- with a nice large spike where the signal is, soaring high above the level of the noise. But mine don't look nearly that nice.





The circled peak is the signal I'm after.

Edited by - rrwoods on 06/22/2004 11:56:15 AM
Mike Buess Posted - 06/22/2004 : 11:38:46 AM
I don't have Origin 6.0 here but don't see your tightening effect in Origin 7.5. The FFT of the simple time domain signal below shows somewhat more phase scatter in the noise region (higher frequencies) but it is, after all, noise. (BTW, Easwar's script duplicates the wrapped phases well but for a small offset.)

I'm curious why you are keying on the phase when your signal (non-complex) carries no phase information. Looking at the phase and amplitude plots below I would think that your bandpass settings could much more easily be determined from the amplitude data.





Mike Buess
Origin WebRing Member
rrwoods Posted - 06/22/2004 : 09:59:22 AM
OK Here's the thing: I LIKE what Origin is doing -- whatever it's doing -- to unwrap the phase here. Allow me to explain.

The data I'm having Origin FFT is data from a .wav file, which I've extracted to a text file and pasted into a Y column. I paste the times at which each sample was taken in the X column. I have Origin do the FFT on these two columns -- with shifting on, so that the frequencies range from -1/2 the sample rate to +1/2 the sample rate -- and I see the result graph, which is the positive half of the Phase Angle and Power vs. Frequency graph. Now, the original sound file was a bird call which can barely be heard over all sorts of noise.

Here's the clincher: Whatever algorithm Origin uses to unwrap the phase results in something very peculiar. Where there is nothing but noise, the Phase angle oscillates wildly. Where there is a "real" signal, the Phase angle oscillates within a much smaller range.

My job is to write a program that can look at numbers extracted from a sound file, perform the FFT (I have done up to this part), decide where to do a band pass filter and do it, then write the resulting numbers back to a sound file. My dilemma is that I need to reproduce the Phase angle numbers that Origin is producing -- however incorrectly they may be generated -- so that I can have this "tightening" effect around the area where there is a real signal over the noise.

I have verified this tightening effect by performing some calculations on the Phase data. For this example (I have done several), I used a file which contained a bird call around 8000 Hz, with scattered noise across the other frequencies. I extracted the data from the file and had Origin do the FFT. Then I did a 1000 point running average (available from the Smoothing menu) across the Phase data. Then I graphed the derivative of this new data set. The derivative varied wildly -- between -30 and +30 -- except around 8000 Hz. Around that frequency, the derivative was very small, staying well within the range of -5 to +5.

If there is a bug in Origin 6, that's fine -- I need to reproduce it.
easwar Posted - 06/18/2004 : 9:47:43 PM

All of these values are between -180 and +180, and all of the successive changes between values are greater than 180. Maybe the cutoff is something other than 180 degrees?


EDIT: BTW, I'm using Origin 6.0. Maybe there's bugs in that version that cause these larger jumps to happen?

[/quote]

Hello,

Yes, the unwrapping looks for successive jumps that are larger than +/180 and addes +/-360. So you should not see values with larger than 180 degrees difference between successive points.

As you mentioned, it is possible that there was a bug in 6.0 and was subsequently fixed either in a service release for 6.0 or in a later version. I currently do not have access to 6.0 and so can look into this further on Monday.

I suggest that you try patching your 6.0 to the latest available service release for that version, if you have not already done so, and try again.

Easwar
OriginLab


rrwoods Posted - 06/18/2004 : 4:04:20 PM
Ah... I see... So unwrapping the phase basically changes the results of the arctan() function so that there is no change in phase whose abolute value is greater than 180 degrees. But if that's the case, then when I check the unwrap phase option, the following sequence of values shouldn't appear:

-147.54849
98.88555
-154.8609
83.96611
-114.23099
88.72822

All of these values are between -180 and +180, and all of the successive changes between values are greater than 180. Maybe the cutoff is something other than 180 degrees?


EDIT: BTW, I'm using Origin 6.0. Maybe there's bugs in that version that cause these larger jumps to happen?

Edited by - rrwoods on 06/18/2004 4:07:28 PM
easwar Posted - 06/18/2004 : 2:49:38 PM
Hello,

When the "Unwrap Phase" check box is unchecked, the phase values are in the range of -180 to +180 deg. as expected.

Now, if user checks this box, then an unwrapping of the phase is perfomred to compute a cumulative phase. Since this value is cumulative, it goes beyond +/-180 degrees.

Unwrapping is usually performed to eliminate the 360 degree jumps caused in the phase computation due to the artifact of the arctan() function used in computing the phase.

The unwrapping for creating the cumlative phase is performed by examining the change in phase from one point to the next. The following LabTalk script shows the algorithm used:
It is assumed in this script that column B of worksheet Data1 contains the wrapped phase (that goes between +/-180 deg) and there is a column C which will then contain the computation of the unwrapping. This script further assumes 512 points.

Easwar
OriginLab


phPrev = 0;
phCum = 0;
for(i=1;i<=512;i++)
{
phNew = data1_b[i];
delta = phNew-phPrev;
phPrev = phNew;

if(delta > 180)
delta = delta - 360;
else
{
if(delta < -180)
delta = delta + 360;
}

phCur = delta + phCum;
phCum = phCur;

data1_c[i] = phCur;
}







The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000