DSPRelated.com
Forums

Phase of FFT compared to phase of Sinusoid

Started by Unknown March 21, 2006
in article 1143184207.713932.128110@j33g2000cwa.googlegroups.com, Ron N. at
rhnlogic@yahoo.com wrote on 03/24/2006 02:10:

> So I think the in general case, the DFT/FFT phase is really > referenced to sample N/2,
no. since the DFT is an operation that literally imposes periodicity or circularity on the input data, there is no qualitative difference between boundaries between N/2-1 and N/2 or between N-1 and N (or 0).
> with a fixed reference rotation back > to sample 0 depending on bin number (even or odd),
that even/odd thing is because you're referencing at N/2. half the time you'll be right, the other half you'll be off by 180 degrees.
> which is why a sample 0 reference seems to work, but only when > assuming only bin center frequencies exist.
so when the sinusoid is just a teeny milli-smidgen off of the center frequency, there is some kind of step function that makes this work totally differently? Ron, i'll be stepping out for a couple of days, but this is a problem that can be solved mathematically (even for the case where the frequency is not dead center for the bin). the "y-axis" for the input sequence goes through x[0] and, it is against that the time of that "y-axis" that the phase is measured against. now it is *true* (but i don't think the definition) that the DFT is equal to the N equally spaced samples of the DTFT of the same sequence of x[n] that is ZERO-extended (not periodically extended). ask yourself what the DTFT of that zero-extended sequence is for the case that the frequency is not an integer multiple of 1/N. use a complex sinusoid exp(j*2*pi*f0 + theta) where f0 is not M/N. find the peak (it will be the middle of the sinc() function), and evaluate the phase of the DTFT at that peak. i'll bet you that it is theta. now, for the discrete samples in the freq domain that are adjacent to that peak (at indices floor(N*f0) and floor(N*f0)+1) the phase will be different, but not that much different. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
in article 1143184207.713932.128110@j33g2000cwa.googlegroups.com, Ron N. at
rhnlogic@yahoo.com wrote on 03/24/2006 02:10:

> So I think the in general case, the DFT/FFT phase is really > referenced to sample N/2,
no. since the DFT is an operation that literally imposes periodicity or circularity on the input data, there is no qualitative difference between boundaries between N/2-1 and N/2 or between N-1 and N (or 0).
> with a fixed reference rotation back > to sample 0 depending on bin number (even or odd),
that even/odd thing is because you're referencing at N/2. half the time you'll be right, the other half you'll be off by 180 degrees.
> which is why a sample 0 reference seems to work, but only when > assuming only bin center frequencies exist.
so when the sinusoid is just a teeny milli-smidgen off of the center frequency, there is some kind of step function that makes this work totally differently? Ron, i'll be stepping out for a couple of days, but this is a problem that can be solved mathematically (even for the case where the frequency is not dead center for the bin). the "y-axis" for the input sequence goes through x[0] and, it is against that the time of that "y-axis" that the phase is measured against. now it is *true* (but i don't think the definition) that the DFT is equal to the N equally spaced samples of the DTFT of the same sequence of x[n] that is ZERO-extended (not periodically extended). ask yourself what the DTFT of that zero-extended sequence is for the case that the frequency is not an integer multiple of 1/N. use a complex sinusoid exp(j*2*pi*f0 + theta) where f0 is not M/N. find the peak (it will be the middle of the sinc() function), and evaluate the phase of the DTFT at that peak. i'll bet you that it is theta. now, for the discrete samples in the freq domain that are adjacent to that peak (at indices floor(N*f0) and floor(N*f0)+1) the phase will be different, but not that much different. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
in article 1143184207.713932.128110@j33g2000cwa.googlegroups.com, Ron N. at
rhnlogic@yahoo.com wrote on 03/24/2006 02:10:

> So I think the in general case, the DFT/FFT phase is really > referenced to sample N/2,
no. since the DFT is an operation that literally imposes periodicity or circularity on the input data, there is no qualitative difference between boundaries between N/2-1 and N/2 or between N-1 and N (or 0).
> with a fixed reference rotation back > to sample 0 depending on bin number (even or odd),
that even/odd thing is because you're referencing at N/2. half the time you'll be right, the other half you'll be off by 180 degrees.
> which is why a sample 0 reference seems to work, but only when > assuming only bin center frequencies exist.
so when the sinusoid is just a teeny milli-smidgen off of the center frequency, there is some kind of step function that makes this work totally differently? Ron, i'll be stepping out for a couple of days, but this is a problem that can be solved mathematically (even for the case where the frequency is not dead center for the bin). the "y-axis" for the input sequence goes through x[0] and, it is against that the time of that "y-axis" that the phase is measured against. now it is *true* (but i don't think the definition) that the DFT is equal to the N equally spaced samples of the DTFT of the same sequence of x[n] that is ZERO-extended (not periodically extended). ask yourself what the DTFT of that zero-extended sequence is for the case that the frequency is not an integer multiple of 1/N. use a complex sinusoid exp(j*2*pi*f0 + theta) where f0 is not M/N. find the peak (it will be the middle of the sinc() function), and evaluate the phase of the DTFT at that peak. i'll bet you that it is theta. now, for the discrete samples in the freq domain that are adjacent to that peak (at indices floor(N*f0) and floor(N*f0)+1) the phase will be different, but not that much different. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
in article 1143184207.713932.128110@j33g2000cwa.googlegroups.com, Ron N. at
rhnlogic@yahoo.com wrote on 03/24/2006 02:10:

> So I think the in general case, the DFT/FFT phase is really > referenced to sample N/2,
no. since the DFT is an operation that literally imposes periodicity or circularity on the input data, there is no qualitative difference between boundaries between N/2-1 and N/2 or between N-1 and N (or 0).
> with a fixed reference rotation back > to sample 0 depending on bin number (even or odd),
that even/odd thing is because you're referencing at N/2. half the time you'll be right, the other half you'll be off by 180 degrees.
> which is why a sample 0 reference seems to work, but only when > assuming only bin center frequencies exist.
so when the sinusoid is just a teeny milli-smidgen off of the center frequency, there is some kind of step function that makes this work totally differently? Ron, i'll be stepping out for a couple of days, but this is a problem that can be solved mathematically (even for the case where the frequency is not dead center for the bin). the "y-axis" for the input sequence goes through x[0] and, it is against that the time of that "y-axis" that the phase is measured against. now it is *true* (but i don't think the definition) that the DFT is equal to the N equally spaced samples of the DTFT of the same sequence of x[n] that is ZERO-extended (not periodically extended). ask yourself what the DTFT of that zero-extended sequence is for the case that the frequency is not an integer multiple of 1/N. use a complex sinusoid exp(j*2*pi*f0 + theta) where f0 is not M/N. find the peak (it will be the middle of the sinc() function), and evaluate the phase of the DTFT at that peak. i'll bet you that it is theta. now, for the discrete samples in the freq domain that are adjacent to that peak (at indices floor(N*f0) and floor(N*f0)+1) the phase will be different, but not that much different. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
in article 1143184207.713932.128110@j33g2000cwa.googlegroups.com, Ron N. at
rhnlogic@yahoo.com wrote on 03/24/2006 02:10:

> So I think the in general case, the DFT/FFT phase is really > referenced to sample N/2,
no. since the DFT is an operation that literally imposes periodicity or circularity on the input data, there is no qualitative difference between boundaries between N/2-1 and N/2 or between N-1 and N (or 0).
> with a fixed reference rotation back > to sample 0 depending on bin number (even or odd),
that even/odd thing is because you're referencing at N/2. half the time you'll be right, the other half you'll be off by 180 degrees.
> which is why a sample 0 reference seems to work, but only when > assuming only bin center frequencies exist.
so when the sinusoid is just a teeny milli-smidgen off of the center frequency, there is some kind of step function that makes this work totally differently? Ron, i'll be stepping out for a couple of days, but this is a problem that can be solved mathematically (even for the case where the frequency is not dead center for the bin). the "y-axis" for the input sequence goes through x[0] and, it is against that the time of that "y-axis" that the phase is measured against. now it is *true* (but i don't think the definition) that the DFT is equal to the N equally spaced samples of the DTFT of the same sequence of x[n] that is ZERO-extended (not periodically extended). ask yourself what the DTFT of that zero-extended sequence is for the case that the frequency is not an integer multiple of 1/N. use a complex sinusoid exp(j*2*pi*f0 + theta) where f0 is not M/N. find the peak (it will be the middle of the sinc() function), and evaluate the phase of the DTFT at that peak. i'll bet you that it is theta. now, for the discrete samples in the freq domain that are adjacent to that peak (at indices floor(N*f0) and floor(N*f0)+1) the phase will be different, but not that much different. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
in article 1143184207.713932.128110@j33g2000cwa.googlegroups.com, Ron N. at
rhnlogic@yahoo.com wrote on 03/24/2006 02:10:

> So I think the in general case, the DFT/FFT phase is really > referenced to sample N/2,
no. since the DFT is an operation that literally imposes periodicity or circularity on the input data, there is no qualitative difference between boundaries between N/2-1 and N/2 or between N-1 and N (or 0).
> with a fixed reference rotation back > to sample 0 depending on bin number (even or odd),
that even/odd thing is because you're referencing at N/2. half the time you'll be right, the other half you'll be off by 180 degrees.
> which is why a sample 0 reference seems to work, but only when > assuming only bin center frequencies exist.
so when the sinusoid is just a teeny milli-smidgen off of the center frequency, there is some kind of step function that makes this work totally differently? Ron, i'll be stepping out for a couple of days, but this is a problem that can be solved mathematically (even for the case where the frequency is not dead center for the bin). the "y-axis" for the input sequence goes through x[0] and, it is against that the time of that "y-axis" that the phase is measured against. now it is *true* (but i don't think the definition) that the DFT is equal to the N equally spaced samples of the DTFT of the same sequence of x[n] that is ZERO-extended (not periodically extended). ask yourself what the DTFT of that zero-extended sequence is for the case that the frequency is not an integer multiple of 1/N. use a complex sinusoid exp(j*2*pi*f0 + theta) where f0 is not M/N. find the peak (it will be the middle of the sinc() function), and evaluate the phase of the DTFT at that peak. i'll bet you that it is theta. now, for the discrete samples in the freq domain that are adjacent to that peak (at indices floor(N*f0) and floor(N*f0)+1) the phase will be different, but not that much different. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
in article 1143184207.713932.128110@j33g2000cwa.googlegroups.com, Ron N. at
rhnlogic@yahoo.com wrote on 03/24/2006 02:10:

> So I think the in general case, the DFT/FFT phase is really > referenced to sample N/2,
no. since the DFT is an operation that literally imposes periodicity or circularity on the input data, there is no qualitative difference between boundaries between N/2-1 and N/2 or between N-1 and N (or 0).
> with a fixed reference rotation back > to sample 0 depending on bin number (even or odd),
that even/odd thing is because you're referencing at N/2. half the time you'll be right, the other half you'll be off by 180 degrees.
> which is why a sample 0 reference seems to work, but only when > assuming only bin center frequencies exist.
so when the sinusoid is just a teeny milli-smidgen off of the center frequency, there is some kind of step function that makes this work totally differently? Ron, i'll be stepping out for a couple of days, but this is a problem that can be solved mathematically (even for the case where the frequency is not dead center for the bin). the "y-axis" for the input sequence goes through x[0] and, it is against that the time of that "y-axis" that the phase is measured against. now it is *true* (but i don't think the definition) that the DFT is equal to the N equally spaced samples of the DTFT of the same sequence of x[n] that is ZERO-extended (not periodically extended). ask yourself what the DTFT of that zero-extended sequence is for the case that the frequency is not an integer multiple of 1/N. use a complex sinusoid exp(j*2*pi*f0 + theta) where f0 is not M/N. find the peak (it will be the middle of the sinc() function), and evaluate the phase of the DTFT at that peak. i'll bet you that it is theta. now, for the discrete samples in the freq domain that are adjacent to that peak (at indices floor(N*f0) and floor(N*f0)+1) the phase will be different, but not that much different. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
this is a repost because of a little mistake.

in article 1143184207.713932.128110@j33g2000cwa.googlegroups.com, Ron N. at
rhnlogic@yahoo.com wrote on 03/24/2006 02:10:

> So I think the in general case, the DFT/FFT phase is really > referenced to sample N/2,
no. since the DFT is an operation that literally imposes periodicity or circularity on the input data, there is no qualitative difference between boundaries between N/2-1 and N/2 or between N-1 and N (or 0).
> with a fixed reference rotation back > to sample 0 depending on bin number (even or odd),
that even/odd thing is because you're referencing at N/2. half the time you'll be right, the other half you'll be off by 180 degrees.
> which is why a sample 0 reference seems to work, but only when > assuming only bin center frequencies exist.
so when the sinusoid is just a teeny milli-smidgen off of the center frequency, there is some kind of step function that makes this work totally differently? Ron, i'll be stepping out for a couple of days, but this is a problem that can be solved mathematically (even for the case where the frequency is not dead center for the bin). the "y-axis" for the input sequence goes through x[0] and, it is against that the time of that "y-axis" that the phase is measured against. now it is *true* (but i don't think the definition) that the DFT is equal to the N equally spaced samples of the DTFT of the same sequence of x[n] that is ZERO-extended (not periodically extended). ask yourself what the DTFT of that zero-extended sequence is for the case that the frequency is not an integer multiple of 1/N. use a complex sinusoid: x[n] = exp(j*2*pi*f0*n + theta) where f0 is not M/N . find the peak (it will be the middle of the sinc() function), and evaluate the phase of the DTFT at that peak. i'll bet you that it is theta. now, for the discrete samples in the freq domain that are adjacent to that peak (at indices floor(N*f0) and floor(N*f0)+1) the phase will be different, but not that much different. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
robert bristow-johnson wrote:
> in article 1143184207.713932.128110@j33g2000cwa.googlegroups.com, Ron N. at > rhnlogic@yahoo.com wrote on 03/24/2006 02:10: > >> So I think the in general case, the DFT/FFT phase is really >> referenced to sample N/2, > > no. since the DFT is an operation that literally imposes periodicity or > circularity on the input data, there is no qualitative difference between > boundaries between N/2-1 and N/2 or between N-1 and N (or 0).
You really need to post a disclaimer.
> >> with a fixed reference rotation back >> to sample 0 depending on bin number (even or odd), > > that even/odd thing is because you're referencing at N/2. half the time > you'll be right, the other half you'll be off by 180 degrees. > >> which is why a sample 0 reference seems to work, but only when >> assuming only bin center frequencies exist. > > so when the sinusoid is just a teeny milli-smidgen off of the center > frequency, there is some kind of step function that makes this work totally > differently? > > Ron, i'll be stepping out for a couple of days, but this is a problem that > can be solved mathematically (even for the case where the frequency is not > dead center for the bin). the "y-axis" for the input sequence goes through > x[0] and, it is against that the time of that "y-axis" that the phase is > measured against. > > now it is *true* (but i don't think the definition) that the DFT is equal to > the N equally spaced samples of the DTFT of the same sequence of x[n] that > is ZERO-extended (not periodically extended). ask yourself what the DTFT of > that zero-extended sequence is for the case that the frequency is not an > integer multiple of 1/N. use a complex sinusoid exp(j*2*pi*f0 + theta) > where f0 is not M/N. find the peak (it will be the middle of the sinc() > function), and evaluate the phase of the DTFT at that peak. i'll bet you > that it is theta. now, for the discrete samples in the freq domain that are > adjacent to that peak (at indices floor(N*f0) and floor(N*f0)+1) the phase > will be different, but not that much different. >
robert bristow-johnson wrote:
> in article 1143184207.713932.128110@j33g2000cwa.googlegroups.com, Ron N. at > rhnlogic@yahoo.com wrote on 03/24/2006 02:10: > > > So I think the in general case, the DFT/FFT phase is really > > referenced to sample N/2, > > no. since the DFT is an operation that literally imposes periodicity or > circularity on the input data, there is no qualitative difference between > boundaries between N/2-1 and N/2 or between N-1 and N (or 0). > > > with a fixed reference rotation back > > to sample 0 depending on bin number (even or odd), > > that even/odd thing is because you're referencing at N/2. half the time > you'll be right, the other half you'll be off by 180 degrees. > > > which is why a sample 0 reference seems to work, but only when > > assuming only bin center frequencies exist. > > so when the sinusoid is just a teeny milli-smidgen off of the center > frequency, there is some kind of step function that makes this work totally > differently?
Not a step function. The phase offset between sample 0 and sample n/2 will vary continuously with how much the signal sinusoid is between bin center frequencies.
> now it is *true* (but i don't think the definition) that the DFT is equal to > the N equally spaced samples of the DTFT of the same sequence of x[n] that > is ZERO-extended (not periodically extended). ask yourself what the DTFT of > that zero-extended sequence is for the case that the frequency is not an > integer multiple of 1/N. use a complex sinusoid exp(j*2*pi*f0 + theta) > where f0 is not M/N. find the peak (it will be the middle of the sinc() > function), and evaluate the phase of the DTFT at that peak. i'll bet you > that it is theta. now, for the discrete samples in the freq domain that are > adjacent to that peak (at indices floor(N*f0) and floor(N*f0)+1) the phase > will be different, but not that much different.
If you interpolate phase as well as frequency, then the interpolated phase will be referenced to bin 0. I agree with the above; and I understand your point. You are looking at DFT results as samples of a continuous frequency response. However, the continuous frequency response can only be represented or reconstructed by DFT sample points under certain constraints, which are often not met in actual use of FFT analysis. The continuous representation also can only be reconstructed if one calculates the full FFT/DFT. However, if you don't interpolate, but interpret the FFT/DFT results as correlations against template sinusoids or a matched filter bank, then any average phase offset for a least squared fit of a sinusoid at one of the bin frequencies to the unknown signal is from the center (n/2) of that particular (FIR equivalent) bin filter. This is useful when calculating only one bin (or maybe a few) of a DFT, where interpolation or reconstruction is impossible. One bin is useful if you have a good but approximate guess as to the frequency content of a signal. Parseval's theorem can be used to safely validate a one bin guess. Then phase vocoder analysis, using DFT bins offset in time rather than frequency, can sometimes help gain more knowledge about a signal, and sometimes at a lower computational cost than a full FFT (if you don't need to reconstruct or examine other frequencies of course). So you were talking about phase reconstruction in a full DFT, and I was talking about how to gain phase knowledge from a single bin. Sorry for the confusion. That's why I was asking about how to talk about single bin DFT's earlier in this group. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M