DSPRelated.com
Forums

phase of FFT

Started by evawoo May 7, 2012
Andre <lodwig@pathme.de> writes:

> On 08.05.2012 05:40, Randy Yates wrote: >> "evawoo"<evawoo09@n_o_s_p_a_m.gmail.com> writes: >> >>> Hey all, >>> >>> I'm new here. >>> Currently I'm struggling with the phase of FFT. I read that the phase of >>> FFT is relative to the start of the time domian signal. In my measurement I >>> recorded a signal which is a sinus sweeping from 100hz to 3000hz. after FFT >>> i obtained a phase spectrum within the specified frequency range. what I >>> dont get is how do we get for each frequency component a phase if the phase >>> of fft related only to the start time. How does the phase is transformed >>> from the time domain to the frequency domain.. I would really appreciate if >>> some of you guys provide me an explaination regarding to this. >> >> Eva, >> >> I have perhaps a slightly different view of the FFT magnitude and >> phases; I hope it is a simple view (as simple as possible?): >> >> The N complex values (magnitude/phase, in polar form) which result >> from an N-point FFT are the N Fourier coefficients describing the >> infinite, periodic, signal which would result when the given N input >> samples x[n], n = 0, 1, ..., N-1 are extended as a periodic signal >> in which x[n] = x[n + M*N]. >> >> And so the "phase" is simply that required for the series to represent >> the signal. >> >> Thus "phase" is not really the phase you may be looking for at all. For >> example, think of the case of sampling a sine wave in which the N >> samples span only a portion of the sine wave period (at some given >> sample rate). Then that phase really has nothing to do with the sine >> wave phase theta (sin(w * t + omega)) but instead deals with the phase >> required to represent the N-point periodic sequence you picked from the >> original signal. >> >> How does one approximate the "true" frequency domain of a non-periodic >> input signal? Left as an exercise... > > worded differently, the FFT result gives you a "recipe" how to > construct your original signal from sine waves. The FFT result just > tells you what amplitude and phase to use for each sine component.
That's a succinct summary, but it is also a little dangerous in not defining exactly what is meant by "original signal." -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Randy Yates <yates@digitalsignallabs.com> writes:
> [...] > Then that phase really has nothing to do with the sine > wave phase theta (sin(w * t + omega)) ...
Well, I probably shouldn't have said it has "nothing" to do with it - it is related in some way, just not the way you think it to be. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
The phase of a canonical FFT is a bit stupid.  It references
phase to the edges of the FFT aperture.  However, commonly the
edges of the window are often discontinuous, making the phase
not to meaningful, except for reconstruction.  But if you
re-reference phase to the center of the FFT aperture by doing an
FFTShift, now phase is relative to the center of the window.
Furthermore the phase now has a simple meaning in terms of the
component of the signal being odd or even, or a ratio of the
two.  And because the odd and evenness is continuous between
bins, phase which is referenced to the center can also be
interpolated between bins when dealing with narrow-band
spectral signals that are not necessarily periodic.  So just use
fft shift (rotate the data input or twiddle every other bin of the
result) and the phase (relative to the center) will make sense.

IMHO. YMMV.
-- 
rhn AT nicholson d0t CoM
http://www.nicholson.com/rhn/dsp.html 
On Monday, May 14, 2012 11:01:36 AM UTC-7, Ron N. wrote:
> The phase of a canonical FFT is a bit stupid. It references > phase to the edges of the FFT aperture. However, commonly the > edges of the window are often discontinuous, making the phase > not to meaningful... > rhn AT nicholson d0t CoM
The phase of the DFT is referenced to the basis functions. The basis functions provide a phase reference for each frequency for each time sample. The basis functions do not have discontinuities. No extra manipulation needed nor the hand waving or mumbo-jumbo. Dale B. Dalrymple
Ron N. <rhnlogic@yahoo.com> wrote:

> The phase of a canonical FFT is a bit stupid. It references > phase to the edges of the FFT aperture.
If you consider the input (or it actually is) periodic, then it is a convenient reference for the periodic signal.
> However, commonly the > edges of the window are often discontinuous, making the phase > not to meaningful, except for reconstruction. But if you > re-reference phase to the center of the FFT aperture by doing an > FFTShift, now phase is relative to the center of the window.
Hmm. That changes the sign of odd terms, and leaves even terms alone. And that assumes that the center is (more) meaningfull.
> Furthermore the phase now has a simple meaning in terms of the > component of the signal being odd or even, or a ratio of the > two. And because the odd and evenness is continuous between > bins, phase which is referenced to the center can also be > interpolated between bins when dealing with narrow-band > spectral signals that are not necessarily periodic. So just use > fft shift (rotate the data input or twiddle every other bin of the > result) and the phase (relative to the center) will make sense.
Not so obvious that it makes that much more sense, but I suppose in some cases it might. Then again, pad with zeros on both ends so that there isn't a discontinuity. -- glen
On Monday, May 14, 2012 5:01:42 PM UTC-7, dbd wrote:
> The phase of the DFT is referenced to the basis functions. > The basis functions provide a phase reference for each > frequency for each time sample. The basis functions do > not have discontinuities.
True. But non-periodic data windowed out of a longer indefinite length stream *can* have discontinuities across the ends of the FFT window. And any point on the periodic basis functions (either beginning or middle) can serve equally well as the phase reference point. So there is little reason to pick a phase reference point where the data can be discontinuous in common FFT usage (other than historical convention). Also, when using a window function (von Hann, et.al.), the data at the ends of the window can be quantized into the noise. Referencing a measurement, such as phase, to a point that is mostly noise makes less sense compared with referencing a measurement to the window functions center or peak (where the data is, after windowing and before the FFT). Plus oddness and evenness of a signal in a vector makes more intuitive sense even for data that is not strictly periodic in the FFT aperture. So I recommend using an FFTshift (or equivalent) when doing any phase analysis (phase vocoder, etc.) IMHO. YMMV. -- rhn A.T nicholson d0t CoM http://www.nicholson.com/rhn/dsp.html
Ron N. <rhnlogic@yahoo.com> wrote:
> On Monday, May 14, 2012 5:01:42 PM UTC-7, dbd wrote: >> The phase of the DFT is referenced to the basis functions. >> The basis functions provide a phase reference for each >> frequency for each time sample. The basis functions do >> not have discontinuities.
> True.
> But non-periodic data windowed out of a longer indefinite > length stream *can* have discontinuities across the ends of > the FFT window.
True, but in that case you are likely to get useless results. It is usual in that case to use a different window function that goes to zero on each end, such the discontinuities are avoided.
> And any point on the periodic basis functions > (either beginning or middle) can serve equally well as the > phase reference point. So there is little reason to pick a > phase reference point where the data can be discontinuous > in common FFT usage (other than historical convention).
Well, historically, in the case of continuous transforms it is the center (zero) that is chosen. (Referencing at inifinity doesn't help much at all.) In the case of transforms of periodic functions, though, zero is a fine origin. Among others, it gives the result one would expect from the continuous transform referenced to zero.
> Also, when using a window function (von Hann, et.al.), the > data at the ends of the window can be quantized into the > noise. Referencing a measurement, such as phase, to a point > that is mostly noise makes less sense compared with > referencing a measurement to the window functions center > or peak (where the data is, after windowing and before the > FFT).
But you can also ask about the origin in real space. Some years ago, someone asked about why the FFT of a Gaussian wasn't a Gaussian, as it should be (from the continuous transform). If you reference the transform to zero, with the Gaussian centered at zero, and consider that the second half of the transform input is the negative part. (That is, from 0 to N/2, then -(N-1)/2 to -1.) you get a fine Gaussian out.
> Plus oddness and evenness of a signal in a vector makes > more intuitive sense even for data that is not strictly > periodic in the FFT aperture. So I recommend using an > FFTshift (or equivalent) when doing any phase analysis > (phase vocoder, etc.)
I suppose for (close to) continuous functions like a Gaussian, and when the transform should also be somewhat continuous, then it does come out better. Still, one should avoid the discontinuity in either case. -- glen