DSPRelated.com
Forums

A purely theoretical question

Started by Michael P. May 16, 2013
Hi group

I have a purely theoretical question.

When doing a FFT of an unwindowed pure sine signal, if the frequency
doesn't match a bin frequency, many bins will have a magnitude > 0.
Because the magnitude of each bin fits the same sinc curve, the
magnitude of each bin can be "predicted" (calculated) once you know
the true frequency and magnitude of the original signal.
The formula is:

Magnitude(BinNo) = TrueMagnitude * Sinc(BinNo - TrueBin)

where TrueBin is the non-integer value of the peak location.


Here is my question: 
Can you predict the phase of each bin in the same way.
That is from knowledge of the true peak/phase?
In other words what is the formula for the phase of a bin?
It doesn't seem to be linear according to my experiments.

TIA,
Michael
 
On Thu, 16 May 2013 18:59:48 +0200, Michael P. wrote:

> Hi group > > I have a purely theoretical question. > > When doing a FFT of an unwindowed pure sine signal, if the frequency > doesn't match a bin frequency, many bins will have a magnitude > 0. > Because the magnitude of each bin fits the same sinc curve, the > magnitude of each bin can be "predicted" (calculated) once you know the > true frequency and magnitude of the original signal. The formula is: > > Magnitude(BinNo) = TrueMagnitude * Sinc(BinNo - TrueBin) > > where TrueBin is the non-integer value of the peak location. > > > Here is my question: > Can you predict the phase of each bin in the same way. That is from > knowledge of the true peak/phase? In other words what is the formula for > the phase of a bin? It doesn't seem to be linear according to my > experiments.
For the sake of argument I'll assume that your assertion about magnitude is correct -- I'm too lazy to go check the math on that. Did you work that out from first principles, or just by experimentation? This is definitely one of those times where an answer derived by experimentation has far less weight than one arrived at by solving things symbolically. Be that as it may: Phase, in general, is a nonlinear relationship between the two elements of a complex number, so while the real and imaginary parts of your complex number are often related to some other complex number in a purely linear fashion, the phases will not relate similarly. So if your magnitude relation is correct, then if you find the _complex value_ of the bin by multiplying the "true magnitude" by some complex value, then you'll have a linear relationship from which you can then extract the phase. -- 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
Michael P. <me@home.com> wrote:
 
> When doing a FFT of an unwindowed pure sine signal, if the frequency > doesn't match a bin frequency, many bins will have a magnitude > 0. > Because the magnitude of each bin fits the same sinc curve, the > magnitude of each bin can be "predicted" (calculated) once you know > the true frequency and magnitude of the original signal. > The formula is:
> Magnitude(BinNo) = TrueMagnitude * Sinc(BinNo - TrueBin)
> where TrueBin is the non-integer value of the peak location.
If you think in terms of the Fourier series, instead of the Fourier transform, then it is more obvious.
> Here is my question: > Can you predict the phase of each bin in the same way. > That is from knowledge of the true peak/phase? > In other words what is the formula for the phase of a bin? > It doesn't seem to be linear according to my experiments.
You get the cosine (real) and sine (imaginary) terms from the frequency and phase of the input signal over the window. First do a change of variables so that the window goes from zero (left side) to 2pi (right side). The Fourier series is the sum of cosines and sines, periodic over the window, that sum to your input signal. If you go through the math, the sinc comes from the (continuous) Fourier transform of the rectangular window. -- glen
"Tim Wescott" <tim@seemywebsite.com> wrote in message 
news:KOWdnZp18IDXuAjMnZ2dnUVZ5o0AAAAA@giganews.com...
> On Thu, 16 May 2013 18:59:48 +0200, Michael P. wrote: > >> Hi group >> >> I have a purely theoretical question. >> >> When doing a FFT of an unwindowed pure sine signal, if the frequency >> doesn't match a bin frequency, many bins will have a magnitude > 0. >> Because the magnitude of each bin fits the same sinc curve, the >> magnitude of each bin can be "predicted" (calculated) once you know the >> true frequency and magnitude of the original signal. The formula is: >> >> Magnitude(BinNo) = TrueMagnitude * Sinc(BinNo - TrueBin) >> >> where TrueBin is the non-integer value of the peak location. >> >> >> Here is my question: >> Can you predict the phase of each bin in the same way. That is from >> knowledge of the true peak/phase? In other words what is the formula for >> the phase of a bin? It doesn't seem to be linear according to my >> experiments. > > For the sake of argument I'll assume that your assertion about magnitude > is correct -- I'm too lazy to go check the math on that. > > Did you work that out from first principles, or just by experimentation? > This is definitely one of those times where an answer derived by > experimentation has far less weight than one arrived at by solving things > symbolically.
I did this using the fact that a rectangular window transforms to a sinc function. I posted my derivation on 20-05-2011.
> Be that as it may: > > Phase, in general, is a nonlinear relationship between the two elements > of a complex number, so while the real and imaginary parts of your > complex number are often related to some other complex number in a purely > linear fashion, the phases will not relate similarly. > > So if your magnitude relation is correct, then if you find the _complex > value_ of the bin by multiplying the "true magnitude" by some complex > value, then you'll have a linear relationship from which you can then > extract the phase.
That is true. I will see if I can find the complex value to multiply with.
> -- > 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
"glen herrmannsfeldt" <gah@ugcs.caltech.edu> wrote in message 
news:kn38lr$90j$1@speranza.aioe.org...
> Michael P. <me@home.com> wrote: > >> When doing a FFT of an unwindowed pure sine signal, if the frequency >> doesn't match a bin frequency, many bins will have a magnitude > 0. >> Because the magnitude of each bin fits the same sinc curve, the >> magnitude of each bin can be "predicted" (calculated) once you know >> the true frequency and magnitude of the original signal. >> The formula is: > >> Magnitude(BinNo) = TrueMagnitude * Sinc(BinNo - TrueBin) > >> where TrueBin is the non-integer value of the peak location. > > If you think in terms of the Fourier series, instead of > the Fourier transform, then it is more obvious. > >> Here is my question: >> Can you predict the phase of each bin in the same way. >> That is from knowledge of the true peak/phase? >> In other words what is the formula for the phase of a bin? >> It doesn't seem to be linear according to my experiments. > > You get the cosine (real) and sine (imaginary) terms from the > frequency and phase of the input signal over the window. > > First do a change of variables so that the window goes from > zero (left side) to 2pi (right side). The Fourier series is the > sum of cosines and sines, periodic over the window, that sum to > your input signal. > > If you go through the math, the sinc comes from the > (continuous) Fourier transform of the rectangular window. > > -- glen
Thanks. Yes, of course Re() are cosine terms and Im() are sine terms. Why didn't I think of that. I'm still not sure what the formula would look like though. I would be happy with a formula for Re(BinNo) and one for Im(BinNo).
Michael P. <me@home.com> wrote:
> "Tim Wescott" <tim@seemywebsite.com> wrote in message
(snip)
>> For the sake of argument I'll assume that your assertion about magnitude >> is correct -- I'm too lazy to go check the math on that.
(snip)
> I did this using the fact that a rectangular window transforms > to a sinc function.
It does if symmetric around zero. Otherwise, multiply by the appropriate phase term. -- glen

"glen herrmannsfeldt" <gah@ugcs.caltech.edu> wrote in message 
news:kn3b21$g9d$1@speranza.aioe.org...
> Michael P. <me@home.com> wrote: >> "Tim Wescott" <tim@seemywebsite.com> wrote in message > > (snip) >>> For the sake of argument I'll assume that your assertion about magnitude >>> is correct -- I'm too lazy to go check the math on that. > > (snip) >> I did this using the fact that a rectangular window transforms >> to a sinc function. > > It does if symmetric around zero. Otherwise, multiply by the > appropriate phase term. > > -- glen
That's why I subtract TrueBin in the equation. That makes it centered around zero. I forgot to mention that the magnitude is the absolute value of the right side of the equation.
On May 16, 2:31&#4294967295;pm, glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote:
> Michael P. <m...@home.com> wrote: > > When doing a FFT ...
...
> > If you think in terms of the Fourier series, instead of > the Fourier transform, then it is more obvious. >
oh-oh... :-) r b-j
On Thu, 16 May 2013 18:31:23 +0000, glen herrmannsfeldt wrote:

> Michael P. <me@home.com> wrote: > >> When doing a FFT of an unwindowed pure sine signal, if the frequency >> doesn't match a bin frequency, many bins will have a magnitude > 0. >> Because the magnitude of each bin fits the same sinc curve, the >> magnitude of each bin can be "predicted" (calculated) once you know the >> true frequency and magnitude of the original signal. >> The formula is: > >> Magnitude(BinNo) = TrueMagnitude * Sinc(BinNo - TrueBin) > >> where TrueBin is the non-integer value of the peak location. > > If you think in terms of the Fourier series, instead of the Fourier > transform, then it is more obvious. > >> Here is my question: >> Can you predict the phase of each bin in the same way. >> That is from knowledge of the true peak/phase? >> In other words what is the formula for the phase of a bin? >> It doesn't seem to be linear according to my experiments. > > You get the cosine (real) and sine (imaginary) terms from the frequency > and phase of the input signal over the window. > > First do a change of variables so that the window goes from zero (left > side) to 2pi (right side). The Fourier series is the sum of cosines and > sines, periodic over the window, that sum to your input signal. > > If you go through the math, the sinc comes from the (continuous) Fourier > transform of the rectangular window.
--- and it's not a sinc, not for the FFT. It's an infinite sum. Let fo equal the frequency offset, and fs equal the sampling. Then what gets multiplied in is sum from n = -infinity to +infinity sinc(fo + n * fs). -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
On May 17, 10:23&#4294967295;am, Tim Wescott <t...@seemywebsite.please> wrote:
> On Thu, 16 May 2013 18:31:23 +0000, glen herrmannsfeldt wrote: > > > If you go through the math, the sinc comes from the (continuous) Fourier > > transform of the rectangular window. > > --- and it's not a sinc, not for the FFT. &#4294967295;It's an infinite sum. &#4294967295;Let fo > equal the frequency offset, and fs equal the sampling. &#4294967295;Then what gets > multiplied in is sum from n = -infinity to +infinity sinc(fo + n*fs).
well, it's sorta a sinc(). that's how i look at this Dirichlet thingie. r b-j