Reply by glen herrmannsfeldt May 15, 20122012-05-15
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
Reply by Ron N. May 15, 20122012-05-15
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
Reply by glen herrmannsfeldt May 15, 20122012-05-15
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
Reply by dbd May 14, 20122012-05-14
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
Reply by Ron N. May 14, 20122012-05-14
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 
Reply by Randy Yates May 8, 20122012-05-08
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
Reply by Randy Yates May 8, 20122012-05-08
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
Reply by Andre May 8, 20122012-05-08
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.
Reply by Randy Yates May 8, 20122012-05-08
"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... -- Randy Yates DSP/Firmware Engineer 919-577-9882 (H) 919-720-2916 (C)
Reply by Tim Wescott May 7, 20122012-05-07
On Mon, 07 May 2012 13:55:07 -0500, evawoo wrote:

>>On Mon, 07 May 2012 07:09:56 -0500, evawoo wrote: >> >>> 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. >> >>Every property of the discrete Fourier transform* can be deduced by it's >>mathematical definition -- it may be helpful to review that. >> >>The phase of the DFT isn't _just_ related to the start time of the >>signal > >>-- it's the inherent phase properties of the signal being measured _and_ >>the start time. As a simple example, if your signal is cos(w*t), then >>consider what happens when the sample times are at t_n = n * T_s vs. n * >>T_s + t_f -- the offset time changes the apparent phase of the sampled >>signal, right? And the DFT dutifully measures that phase. >> >>What do you expect to learn from the phase spectrum? >> >> > Hi Tim, > Thanks a lot for the great reply. That was really impressive. > > Actually I got stuck when trying to intepret a phase spectrum plot from > an acoustic measurement. > > I characterized an acoustic system by taking a complex TF (transfer > function&#65306;frequency response of an output/frequency response of an input) > of the system. the amplitude of the TF gives peaks at resonance > frequencies, which is clear. because the resonance frequency is > frequencies at which the system has the strongest osillation. > > In the phase vs. frequency plot,
If you're doing this for transfer function extraction, you should determine the transfer function by dividing your system output signal (what you measure with the microphones) by your system input signal (what you used to drive the speakers). In that case, your time reference is the same (at least it is if you properly account for all your delays), so the phase of your transfer function is automatically correct -- or at least it's automatically not screwed up by what you've done.
> I observed that the phase reaches to a > minumum degree(-180) at the resonance frequency, and then directly jump > to a maximum(180deg) at the same frequency. So it seems that I could > obtain the resonance frequency by the phase shift too. But I cant > explain the physical mechanism behind this. It would help me a lot if > you could explain that to me, thanks
You are missing the fact that phase is effectively mapped in a circle: -179.9999 degrees is not almost 360 degrees away from +179.9999 -- rather, it is just next door, 0.0002 degrees away. Or, at least in the case you cite (keeping track of phases can be fun, irritating, mind- bending, or some combination of the three). The fact that you see the phase go through 180 (or -180) degrees at a resonance peak is happenstance: if you take a filter that has a resonance with phase at 180 degrees and cascade it with a filter that has a phase shift of 90 degrees, then you will find that at your resonance peak the phase is 90 degrees. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com