DSPRelated.com
Forums

proper terminology for one bin of an fft/dft?

Started by Ron N. March 13, 2006
robert bristow-johnson wrote:
> in article 1142987696.468220.318440@j33g2000cwa.googlegroups.com, Ron N. at > rhnlogic@yahoo.com wrote on 03/21/2006 19:34: > > > Bob Cain wrote: > ... > >> The DFT samples the continuous frequency domain function that actually > >> describes what the FIR will do. No water splashed anywhere that I can > >> see. :-) > > > > There is a *lot* of splashing. A DFT implies a finite length vector. > > But any window on the real world to create a finite vector will cause > > aliasing. > > boy, Ron. i hadn't seen you around here until recently (< 1 year ago, i > think), but i like what i read. > > *my* orthodoxy in this (which i believe is perfectly compatible with O&S > scripture) is that the DFT maps an infinite periodic sequence with period N > (so an N-vector suffices to define it) in one domain (say the "time domain") > to another infinite periodic sequence with period N in the reciprocal > domain. not only is the windowing in the real world done to yank out a set > of N samples out of a potentially longer stream of samples, when you pass it > to the DFT, you are effectively periodically extending the son-of-a-bitch to > infinity in both directions. (or, to anthropomorphize, the DFT does it or > "assumes" that.)
I prefer to think of a DFT as a finite basis transform. Certain orthodoxy's do hypothesize infinite angels dancing on periodic pins (or is it periodic angels dancing on inifinite pins?) to produce beautiful mathematics. But one can mash data using a DFT operator with no such assumptions. Especially related to real world short non-periodic signals, where lots of pins are often being replaced by even more lead-free solder balls these days... less room for the angels.
> > Any frequency content in the signal that is not an *exact* > > multiple of Fs/N will, after the windowing and fft, look like a sinc > > pulse splashing amplitude all over every bin to the limits of the > > arithmetic precision. > > and you won't be able to tell the difference between that and a > corresponding periodic sequence that, after windowing, has the same N > samples passed to the DFT and has *only* frequencies that are multiples of > Fs/N.
Yes this is theoretically true. However I think this way of looking at things, especially for large N, comes from an orthodoxy that predates statistical mechanics and thermodynamics, where the billiard balls will go backwards perfectly, and N independant sinusoidal sources can just happen to form samples of an exact sinc spectrum.
> > Since a continuous signal can only be reconstructed from the samples > > only if a signal is perfectly bandlimited and infinite in extent, the > > continuous function and the continuous spectrum of any signal from > > the real world can only be approximated by the samples. So I think > > it is reasonable to talk about them separately, unless you are talking > > only about artificial or theoretical signals. > > > > Your assumption of an infinitely repeating signal is only an artifact > > of the finite length window, > > whoa! it's an artifact of passing it to the DFT. the windowing didn't do > that. it's because you are essentially fitting a basis of periodic > functions (all with period N) to that finite, *possibly* windowed set that > you get an infinitely repeating signal.
The window length and the DFT length are independant. Vary them independantly (zero padding for instance) on some non-synthetic signal and see which changes the artifacts in or contents of the result more.
> i'll have to re-evaluate which side of this religious war you are on. > > hmmmmm. > > > and rarely ever applies to any actual > > signal or set of samples. If is very tempting to make assumptions > > which help make a mathematical analysis become more tractable. But > > with the help of computers these days we can sometimes calculate > > estimates of results without making as many false assumptions about > > the actual underlying signal. > > that, i am not sure of, until we get to specifics. > > don't worry Ron, this is a religious war that flames up every few years here > and i am definitely a partisan of a particular POV. (and everyone who > disagrees burns as a heretic.)
most orthodoxy usually requires too much consistancy. a lot of the stuff that actually gets etched into transistors and gates is a less than consistant compromise which changes with time and the technology curve underneath.
> -- > > r b-j rbj@audioimagination.com > > "Imagination is more important than knowledge."
IMHO -- rhn A.T nicholson d.0.t C-o-M
robert bristow-johnson wrote:
> in article 44209c82$0$7533$afc38c87@news.optusnet.com.au, John Monro at > johnmonro@optusnet.com.au wrote on 03/21/2006 19:38: > > >>Eric and Robert, >>I have NEVER found anyone to be confused at the concept that the second >>bin contains the amplitude of F1 and that the first bin contains the >>amplitude of F0. > > > so everyone you know is quite happy with the way indexing is hard-wired into > MATLAB, i s'pose?
Mostly, yes. It irritates some C programmers, but does not confuse them. It is not a difficult concept.
> > that's another religious war we've had here, but IMO, it's more like the > debate the science community (the good guys) are having with the Intelligent > Design folks (who want to pollute our kid's brains with lies). >
I don't thank that is a fair comparison. We are rationally debating an issue. The Intelligent Designers avoid rational debate.
> > X[k] is the value of the "(k)th" or the "(k+1)th" bin?
X[k] is the value of the "(k)th" bin in MATLAB. Actually, I was not trying to re-ignite a previous debate about indexing. I was saying that we should not seek to tamper with the English language to the extent of changing the meaning of 'first,' and of introducing the ugly and awkward 'zero-th' in its place. Regards, John Regards, John
> >
John Monro wrote:


> .... We are rationally debating an issue. ...
>> X[k] is the value of the "(k)th" or the "(k+1)th" bin? > > > X[k] is the value of the "(k)th" bin in MATLAB.
If X[14] is the value of the 14th bin in Matlab, then X[1] is the value if the first bin in Matlab. How about the more usual case where N bins are given the labels 0 to N-1?
> Actually, I was not trying to re-ignite a previous debate about > indexing. I was saying that we should not seek to tamper with the > English language to the extent of changing the meaning of 'first,' and > of introducing the ugly and awkward 'zero-th' in its place.
I'm all for preserving the purity of language, with clarity uppermost. Here, I'm torn. What should one call the item whose ordinal number is zero when dealing with a collection of items numbered from zero? It seems that zeroth is an appropriate short form for "the item whose label is zero." If zeroth is used, then R.B-J.'s oneth and twoth also probably serve as sufficient reminders of departure from the usual names. It is still true that the Nth item is labeled N-1. Is that bad? Jerry -- Engineering is the art of making what you want from things you can get. &#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;&#4294967295;&#4294967295;

Mark Borgerding wrote:

> When I need more rigor, I think of DFT bins as correlations with sinusoids.
Right on! That, as I'm sure you know, is the very definition. If you have a finite duration impulse response, an FIR, then the values at the "bins" are the correlations (inner products actually) between it those specific frequencies *but* there are also values between the bins that are the inner products with the corresponding intermediate frequencies. The values form a continuum. If you pass a real sinusoid through the FIR (after waiting long enough, which in practice isn't very long) at any of those frequencies, "bins" included, you get a result. Since the frequency space available for such stimulation is continuous, so is the frequency domain function that is sampled by the DFT. In so far as "symantics" means "meaning", I'll agree that this is a symantic issue. :-) Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein

Ron N. wrote:

> Your assumption of an infinitely repeating signal is only an artifact > of the finite length window, and rarely ever applies to any actual > signal or set of samples.
Who, me?! Robert can tell you what I think about any assumptions of periodicity. :-) I specifically took an FIR as the example for my view of the whole thing. That's what I work with, not anything that repeats, and it is the behavior and meaning of the DFT with respect to those things that have meaning to me and are the context for my comments. Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein
Jerry Avins wrote:
> John Monro wrote: > > >> .... We are rationally debating an issue. ... > > >>> X[k] is the value of the "(k)th" or the "(k+1)th" bin? >> >> >> >> X[k] is the value of the "(k)th" bin in MATLAB. > > > If X[14] is the value of the 14th bin in Matlab, then X[1] is the value > if the first bin in Matlab. How about the more usual case where N bins > are given the labels 0 to N-1? >
In that case then bin X[14]would be the "the fifteenth bin." (We use the same principle in numbering historical centuries and I don't think it causes any problems.)
>> Actually, I was not trying to re-ignite a previous debate about >> indexing. I was saying that we should not seek to tamper with the >> English language to the extent of changing the meaning of 'first,' and >> of introducing the ugly and awkward 'zero-th' in its place. > > > I'm all for preserving the purity of language, with clarity uppermost. > Here, I'm torn. What should one call the item whose ordinal number is > zero when dealing with a collection of items numbered from zero?
The problem is that this is only one of many numbering systems that may be used, although admittedly a popular system. If we had been using some other form of number identification this discussion would not take place. For example if we had statistical data for years 1980 to 2005 we would not be mulling over what to call the 1980 data set. We would refer to it either by its identifying number (eg. 'the 1980 data set') or by its order (eg. 'the first data set.') It would be plainly ridiculous to seek to re-define the language to allow use to refer to the 1980 data set as 'the 1980th data set.'
> It seems that zeroth is an appropriate short form for "the item whose label > is zero." If zeroth is used, then R.B-J.'s oneth and twoth also probably > serve as sufficient reminders of departure from the usual names. It is > still true that the Nth item is labeled N-1. Is that bad? > Jerry
The problems with Robert's 'oneth' and 'twoth' suggestion is: 1. You then have to re-define the terms 'fourth' (and higher). 2. If the idea catches on, and a published paper refers to, say, the 'fourth' bin but does not mention any lower bins, we will not have enough clues to work out which convention the author is using. A general note: Maybe for clarity we should just avoid using ordinal numbering. Maybe we should just refer to the data's identification number rather than its position. For example, we could write: 'bin 0' or 'year 1980'instead of 'the first bin' or 'the first year's data.' By the way, I see no problem in referring to item (N-1) as the Nth item. Finally, how often is bin 0 the first bin? If bin 0 is defined to be the bin that holds the DC component, then bin 0 is usually in the middle of the unscrambled FFT output. Regards, John
Jerry Avins wrote:
> John Monro wrote: > > >> .... We are rationally debating an issue. ... > > >>> X[k] is the value of the "(k)th" or the "(k+1)th" bin? >> >> >> >> X[k] is the value of the "(k)th" bin in MATLAB. > > > If X[14] is the value of the 14th bin in Matlab, then X[1] is the value > if the first bin in Matlab. How about the more usual case where N bins > are given the labels 0 to N-1? >
In that case then bin X[14]would be the "the fifteenth bin." (We use the same principle in numbering historical centuries and I don't think it causes any problems.)
>> Actually, I was not trying to re-ignite a previous debate about >> indexing. I was saying that we should not seek to tamper with the >> English language to the extent of changing the meaning of 'first,' and >> of introducing the ugly and awkward 'zero-th' in its place. > > > I'm all for preserving the purity of language, with clarity uppermost. > Here, I'm torn. What should one call the item whose ordinal number is > zero when dealing with a collection of items numbered from zero?
The problem is that this is only one of many numbering systems that may be used, although admittedly a popular system. If we had been using some other form of number identification this discussion would not take place. For example if we had statistical data for years 1980 to 2005 we would not be mulling over what to call the 1980 data set. We would refer to it either by its identifying number (eg. 'the 1980 data set') or by its order (eg. 'the first data set.') It would be plainly ridiculous to seek to re-define the language to allow use to refer to the 1980 data set as 'the 1980th data set.'
> It seems that zeroth is an appropriate short form for "the item whose label > is zero." If zeroth is used, then R.B-J.'s oneth and twoth also probably > serve as sufficient reminders of departure from the usual names. It is > still true that the Nth item is labeled N-1. Is that bad? > Jerry
The problems with Robert's 'oneth' and 'twoth' suggestion is: 1. You then have to re-define the terms 'fourth' (and higher). 2. If the idea catches on, and a published paper refers to, say, the 'fourth' bin but does not mention any lower bins, we will not have enough clues to work out which convention the author is using. A general note: Maybe for clarity we should just avoid using ordinal numbering. Maybe we should just refer to the data's identification number rather than its position. For example, we could write: 'bin 0' or 'year 1980'instead of 'the first bin' or 'the first year's data.' By the way, I see no problem in referring to item (N-1) as the Nth item. Finally, how often is bin 0 the first bin? If bin 0 is defined to be the bin that holds the DC component, then bin 0 is usually in the middle of the unscrambled FFT output. Regards, John
John Monro wrote:
> Jerry Avins wrote: > >> John Monro wrote: >> >> >>> .... We are rationally debating an issue. ... >> >> >> >>>> X[k] is the value of the "(k)th" or the "(k+1)th" bin? >>> >>> >>> >>> >>> X[k] is the value of the "(k)th" bin in MATLAB. >> >> >> >> If X[14] is the value of the 14th bin in Matlab, then X[1] is the >> value if the first bin in Matlab. How about the more usual case where >> N bins are given the labels 0 to N-1? >> > In that case then bin X[14]would be the "the fifteenth bin." (We use the > same principle in numbering historical centuries and I don't think it > causes any problems.)
But it does! People are still debating when the 20th century ended.
>>> Actually, I was not trying to re-ignite a previous debate about >>> indexing. I was saying that we should not seek to tamper with the >>> English language to the extent of changing the meaning of 'first,' >>> and of introducing the ugly and awkward 'zero-th' in its place. >> >> >> >> I'm all for preserving the purity of language, with clarity uppermost. >> Here, I'm torn. What should one call the item whose ordinal number is >> zero when dealing with a collection of items numbered from zero? > > > The problem is that this is only one of many numbering systems that may > be used, although admittedly a popular system. > > If we had been using some other form of number identification this > discussion would not take place. For example if we had statistical data > for years 1980 to 2005 we would not be mulling over what to call the > 1980 data set. We would refer to it either by its identifying number > (eg. 'the 1980 data set') or by its order (eg. 'the first data set.') It > would be plainly ridiculous to seek to re-define the language to allow > use to refer to the 1980 data set as 'the 1980th data set.'
Agreed. A problem with "zero bin" instead of "zeroth bin" is that one isn't certain whether "zero" refers to the label or to the contents.
>> It seems that zeroth is an appropriate short form for "the item whose >> label is zero." If zeroth is used, then R.B-J.'s oneth and twoth also >> probably serve as sufficient reminders of departure from the usual >> names. It is still true that the Nth item is labeled N-1. Is that bad? >> Jerry > > > The problems with Robert's 'oneth' and 'twoth' suggestion is: > 1. You then have to re-define the terms 'fourth' (and higher). > 2. If the idea catches on, and a published paper refers to, say, the > 'fourth' bin but does not mention any lower bins, we will not have > enough clues to work out which convention the author is using.
Something's got to give. It's not clear cut.
> A general note: Maybe for clarity we should just avoid using ordinal > numbering. Maybe we should just refer to the data's identification > number rather than its position. For example, we could write: 'bin 0' > or 'year 1980'instead of 'the first bin' or 'the first year's data.'
I like that, but it's not likely to happen.
> By the way, I see no problem in referring to item (N-1) as the Nth item. > > Finally, how often is bin 0 the first bin? If bin 0 is defined to be > the bin that holds the DC component, then bin 0 is usually in the middle > of the unscrambled FFT output.
Jerry -- Engineering is the art of making what you want from things you can get. &#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;&#4294967295;&#4294967295;
in article 44226725$0$20113$afc38c87@news.optusnet.com.au, John Monro at
johnmonro@optusnet.com.au wrote on 03/23/2006 04:15:

> Jerry Avins wrote: >> John Monro wrote: >> >> >>> .... We are rationally debating an issue. ... >> >> >>>> X[k] is the value of the "(k)th" or the "(k+1)th" bin? >>> >>> >>> >>> X[k] is the value of the "(k)th" bin in MATLAB. >> >> >> If X[14] is the value of the 14th bin in Matlab, then X[1] is the value >> if the first bin in Matlab. How about the more usual case where N bins >> are given the labels 0 to N-1? >> > In that case then bin X[14]would be the "the fifteenth bin."
gee, that's not confusing!
> (We use the same principle in numbering historical centuries and I don't > think it causes any problems.)
it's starting to cause problems. particularly when folks like the MathWorks like to encode that historical numbering system into a modern tool (MATLAB) and force everyone to use it. i have, at a different time in my life, spent hours trying to track down an obscure bug in some code (usually a phase vocoder) because some little place i forgot to add 1 to the index or subtract 1 from it.
> >> It seems that zeroth is an appropriate short form for "the item whose label >> is zero." If zeroth is used, then R.B-J.'s oneth and twoth also probably >> serve as sufficient reminders of departure from the usual names. It is >> still true that the Nth item is labeled N-1. Is that bad? > > The problems with Robert's 'oneth' and 'twoth' suggestion is: > 1. You then have to re-define the terms 'fourth' (and higher).
naw, we never really get that high in verbal discussion. it's just that when i used "first" in class when i meant the DC bin, some confusion results.
> 2. If the idea catches on, and a published paper refers to, say, the > 'fourth' bin but does not mention any lower bins, we will not have > enough clues to work out which convention the author is using.
at that level the author should be explicit and say "X[4]" or "X[3]" and make it clear.
> > A general note: Maybe for clarity we should just avoid using ordinal > numbering. Maybe we should just refer to the data's identification > number rather than its position. For example, we could write: 'bin 0' > or 'year 1980'instead of 'the first bin' or 'the first year's data.' > > By the way, I see no problem in referring to item (N-1) as the Nth item. > > Finally, how often is bin 0 the first bin? If bin 0 is defined to be > the bin that holds the DC component, then bin 0 is usually in the middle > of the unscrambled FFT output.
i know what you mean (it's called "fftshift()" in MATLAB), but as it guzzinta or cumsouta the FFT, it's at bin 0. take a look at this handwritten paper by Edsger Dykstra: http://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF it's not just about the C programming language or the numbering of bins in the DFT or iDFT. in our technical evolution, this historical convention should evolve also. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On Tue, 21 Mar 2006 20:12:37 -0500, robert bristow-johnson
<rbj@audioimagination.com> wrote:

>in article 1142987696.468220.318440@j33g2000cwa.googlegroups.com, Ron N. at >rhnlogic@yahoo.com wrote on 03/21/2006 19:34:
...
>> Your assumption of an infinitely repeating signal is only an artifact >> of the finite length window, > >whoa! it's an artifact of passing it to the DFT. the windowing didn't do >that. it's because you are essentially fitting a basis of periodic >functions (all with period N) to that finite, *possibly* windowed set that >you get an infinitely repeating signal. > >i'll have to re-evaluate which side of this religious war you are on. > >hmmmmm.
hehehehe
>> and rarely ever applies to any actual >> signal or set of samples. If is very tempting to make assumptions >> which help make a mathematical analysis become more tractable. But >> with the help of computers these days we can sometimes calculate >> estimates of results without making as many false assumptions about >> the actual underlying signal. > >that, i am not sure of, until we get to specifics. > >don't worry Ron, this is a religious war that flames up every few years here >and i am definitely a partisan of a particular POV. (and everyone who >disagrees burns as a heretic.)
Call me the Human Torch. ;) I think this is just another of those cases where two points of view both provide a suitable model for the characteristics of the subject. Since in this case the subject is a reasonably transcendental mathematical abstraction, I don't find it overly surprising that there are at least two disparate ways of looking at it that are fully functional conceptual models. But that's the same with more traditional religions, too, I suppose. ;) Eric Jacobsen Minister of Algorithms, Intel Corp. My opinions may not be Intel's opinions. http://www.ericjacobsen.org