DSPRelated.com
Forums

Whats the reference phase in an FFT transform?

Started by Shafik October 8, 2004
Hello all,

Assuming a real-data FFT, I'll get an array of complex values,
representing the real and imaginary parts of frequency "bins". I can
find the "phase" of each bin by [tan-1(imag(bin)/real(bin))].

Two questions:

1. What is that phase relative to? It doesnt make sense to say bin 4 is
at phase 60 degrees...its needs a reference. What is that reference?

2. What are the magnitudes and phase of frequencies that lie *between*
the bins. Since I only have a finite number of bins in my FFT.
Thanks a lot!
--Shafik

Shafik wrote:

> Assuming a real-data FFT, I'll get an array of complex values, > representing the real and imaginary parts of frequency "bins". I can > find the "phase" of each bin by [tan-1(imag(bin)/real(bin))].
> Two questions:
> 1. What is that phase relative to? It doesnt make sense to say bin 4 is > at phase 60 degrees...its needs a reference. What is that reference?
Zero degrees. Consider longitude, there has to be a zero somewhere, though it doesn't matter much where as long as it is there.
> 2. What are the magnitudes and phase of frequencies that lie *between* > the bins. Since I only have a finite number of bins in my FFT.
There is no between. The math of FFT assumes periodic boundary conditions, so only frequencies that are a multiple of the fundamental can appear. If this is homework, reference the newsgroup as your source. -- glen
Shafik wrote:

> Hello all, > > Assuming a real-data FFT, I'll get an array of complex values, > representing the real and imaginary parts of frequency "bins". I can > find the "phase" of each bin by [tan-1(imag(bin)/real(bin))]. > > Two questions: > > 1. What is that phase relative to? It doesnt make sense to say bin 4 is > at phase 60 degrees...its needs a reference. What is that reference? > > 2. What are the magnitudes and phase of frequencies that lie *between* > the bins. Since I only have a finite number of bins in my FFT. > Thanks a lot! > --Shafik
The length of the transform defines the fundamental period. The phase of the lowest bin is taken as zero, and a good thing, too: what would phase shift at DC mean? Each of the higher bins represents a different frequency. The phase of each of them is reckoned at the beginning of the period, time zero as far as the transform is concerned. With apology for taking the anthropomorphic easy path, the transform "assumes"* that the input is periodic. For all the transform tells you, there are no frequencies between the bins. Whatever interpretation you choose to assign is fine as long as it's consistent with the problem. Jerry ______________________ * More properly, it gives the same result that it would if the input actually were periodic. -- When a discovery is new, people say, "It isn't true." When it becomes demonstrably true, they say, "It isn't useful." Later, when its utility is evident, they say, "So what? It's old." a paraphrase of William James ���������������������������������������������������������������������
In article <2snuc2F1nmjsbU1@uni-berlin.de>, Jerry Avins  <jya@ieee.org> wrote:
>With apology for taking the anthropomorphic easy path, the transform >"assumes"* that the input is periodic. For all the transform tells you, >there are no frequencies between the bins. Whatever interpretation you >choose to assign is fine as long as it's consistent with the problem.
The other possiblility is to assume that some human interprets the output of the transform as if the input was periodic. However, if the output looks like a sampled Sync, the human can assume that all N frequencies were present in exactly the right magnitude to produce that result, or that a single frequency between bins was present and truncated on a non-periodic boundry. IMHO. YMMV. -- Ron Nicholson rhn AT nicholson DOT com http://www.nicholson.com/rhn/ #include <canonical.disclaimer> // only my own opinions, etc.

Ronald H. Nicholson Jr. wrote:

> In article <2snuc2F1nmjsbU1@uni-berlin.de>, Jerry Avins <jya@ieee.org> wrote:
>>With apology for taking the anthropomorphic easy path, the transform >>"assumes"* that the input is periodic. For all the transform tells you, >>there are no frequencies between the bins. Whatever interpretation you >>choose to assign is fine as long as it's consistent with the problem.
Consider asking a piano player to play the note between B and C. Now ask a trombone player to do the same thing.
> The other possiblility is to assume that some human interprets the > output of the transform as if the input was periodic. However, if > the output looks like a sampled Sync, the human can assume that all > N frequencies were present in exactly the right magnitude to produce > that result, or that a single frequency between bins was present and > truncated on a non-periodic boundry.
Well, yes, but there are an infinite number (or the number that can be represented by the available bits) of possible transform results depending on where between bins the frequency would be and its phase. If you know you have only a single frequency, another thread has suggested how to determine its frequency without using transforms. -- glen
Ronald H. Nicholson Jr. wrote:

> In article <2snuc2F1nmjsbU1@uni-berlin.de>, Jerry Avins <jya@ieee.org> wrote: > >>With apology for taking the anthropomorphic easy path, the transform >>"assumes"* that the input is periodic. For all the transform tells you, >>there are no frequencies between the bins. Whatever interpretation you >>choose to assign is fine as long as it's consistent with the problem. > > > The other possiblility is to assume that some human interprets the > output of the transform as if the input was periodic. However, if > the output looks like a sampled Sync, the human can assume that all > N frequencies were present in exactly the right magnitude to produce > that result, or that a single frequency between bins was present and > truncated on a non-periodic boundry. > > > IMHO. YMMV.
"Whatever interpretation you choose to assign is fine as long as it's consistent with the problem." You kept the asterisk, but snipped what it pointed to: * More properly, it gives the same result that it would if the input actually were periodic. Jerry -- When a discovery is new, people say, "It isn't true." When it becomes demonstrably true, they say, "It isn't useful." Later, when its utility is evident, they say, "So what? It's old." a paraphrase of William James &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
"Shafik" <shafik@u.arizona.edu> wrote in message 
news:1097219449.717290.3010@z14g2000cwz.googlegroups.com...
> Hello all, > > Assuming a real-data FFT, I'll get an array of complex values, > representing the real and imaginary parts of frequency "bins". I can > find the "phase" of each bin by [tan-1(imag(bin)/real(bin))]. > > Two questions: > > 1. What is that phase relative to? It doesnt make sense to say bin 4 is > at phase 60 degrees...its needs a reference. What is that reference? > > 2. What are the magnitudes and phase of frequencies that lie *between* > the bins. Since I only have a finite number of bins in my FFT. > Thanks a lot! > --Shafik
Shafik, 1. Consider the continuous Fourier Transform so we don't have to worry about "bins" for now - the answer is the same. For every frequency there is a phase. Note how we calculate the transform, we integrate over all time, from minus infinity to infinity. And the kernel of that integration is a complex sinusoid. If the input is a pure cosine then the phase is zero. If the input is a pure sine, then the phase is 90 degrees - a delay of 1/4 cycle relative to the cosine). If the input is a pure negative cosine, then the phase is +/-180 degrees (the same as a delay of 1/2 cycle relative to the cosine). So, the answer to your question is: the phase output of a Fourier Transform is relative to the cosine at that same frequency. Also note that phase and delay are closely related with phase being the frequency integral of delay and delay being the frequency derivative of phase. If we pass a family of cosines at different frequencies through a constant delay, the phase of the output from the delay of each succeeding higher frequency cosine is greater. Eventually the phase goes beyond 180 degrees and is, in some sense, ambiguous. However, if we could express the output in terms of delay, all cosines would have the same delay. The reason that phase isn't really ambiguous at the output of a Fourier Transform is because the integral is over all time. So, there is no delay reference anyway. However, if you are computing a Finite Fourier Transform that starts at time=0, then there's a time reference and the ambiguity could be important to you - although most often not. The Discrete Fourier Transform is just a special case of the Finite Fourier Transform - so it has the same characteristic. 2) The answer here is: "it depends". If the input to the FFT(DFT) is a "signal" then the "in-between" values aren't defined. But, you might interpolate. If the input to the FFT(DFT) is a finite-impulse-response (FIR) filter's unit sample response, then that filter actually has a continuous frequency response. However, because the DFT/FFT assumes the input to have been one period of a periodic, discrete time function, then there are no in-between values generated. If you want the in-between values, either (1) don't use the DFT but rather use the Finite (Continuous) Fourier Transform to get a continuous frequency response or (2) interpolate the results from the DFT - perhaps by zero-padding the input data. Fred
Fred Marshall wrote:

   ...

> Shafik, > > 1. Consider the continuous Fourier Transform so we don't have to worry about > "bins" for now - the answer is the same. For every frequency there is a > phase. Note how we calculate the transform, we integrate over all time, > from minus infinity to infinity. And the kernel of that integration is a > complex sinusoid. If the input is a pure cosine then the phase is zero. If > the input is a pure sine, then the phase is 90 degrees - a delay of 1/4 > cycle relative to the cosine). If the input is a pure negative cosine, then > the phase is +/-180 degrees (the same as a delay of 1/2 cycle relative to > the cosine).
... Fred, I think I wrote the same thing, but the way you put it is so much more direct and succinct that my cumbersome explanation is hardly recognizable. Jerry -- When a discovery is new, people say, "It isn't true." When it becomes demonstrably true, they say, "It isn't useful." Later, when its utility is evident, they say, "So what? It's old." a paraphrase of William James &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
"Jerry Avins" <jya@ieee.org> wrote in message 
news:2sou41F1o7n4iU1@uni-berlin.de...
> Fred Marshall wrote: > > ... > >> Shafik, >> >> 1. Consider the continuous Fourier Transform so we don't have to worry >> about "bins" for now - the answer is the same. For every frequency there >> is a phase. Note how we calculate the transform, we integrate over all >> time, from minus infinity to infinity. And the kernel of that >> integration is a complex sinusoid. If the input is a pure cosine then >> the phase is zero. If the input is a pure sine, then the phase is 90 >> degrees - a delay of 1/4 cycle relative to the cosine). If the input is >> a pure negative cosine, then the phase is +/-180 degrees (the same as a >> delay of 1/2 cycle relative to the cosine). > > ... > > Fred, > > I think I wrote the same thing, but the way you put it is so much more > direct and succinct that my cumbersome explanation is hardly > recognizable. > > Jerry
Whoa! Thanks Jerry. And you were kind enough to not mention that mine was much longer! Fred
On 2004-10-08 09:10:49 +0200, "Shafik" <shafik@u.arizona.edu> said:

> Hello all, > > Assuming a real-data FFT, I'll get an array of complex values, > representing the real and imaginary parts of frequency "bins". I can > find the "phase" of each bin by [tan-1(imag(bin)/real(bin))]. > > Two questions: > > 1. What is that phase relative to? It doesnt make sense to say bin 4 is > at phase 60 degrees...its needs a reference. What is that reference?
Right. The reference is your point t=0 within the transform frame.
> 2. What are the magnitudes and phase of frequencies that lie *between* > the bins. Since I only have a finite number of bins in my FFT.
For your DFT, there is no "between the bins". The bins are all you have - that's part of the discrete side of the world. It's like asking what's between your time domain samples. However, if your signal is well behaved, you can expand (interpolate) the space between the bins as a sinc-interpolated sequence of your original Fourier transform. This is easy to imagine if you have understood that the Fourier domain behaves just like the corresponding counterpart called the time domain, with a few rules that govern their mutual relationship. I suggest you use my FFTlab applet to visualize this relationship, and I think I've already made my recommendation to you about my "DFT &#4294967295; Pied" article that discusses the Fourier transform. You can find the applet at http://www.dspdimension.com/html/Lab/FftLab.html and the article at http://www.dspdimension.com/html/dftapied.html -- Stephan M. Bernsee http://www.dspdimension.com