DSPRelated.com
Forums

FFTs of FFTs

Started by jaso...@gmail.com June 24, 2006
MrBurnst wrote:
>>> Somehow I don't believe that differences in that order of magnitude (e-19) >>> are responsable for the behavior I'm observing.
... I wrote
>> If you tack all the zeros at the end, your real samples are in the first >> quarter of the window. That's bound to bias _something_. (Hardly any >> operation is trivial, even if powerful tools make it seem so.)
...
> Well, that's according to the procedure proposed in > http://www.csis.ul.ie/dafx01/proceedings/papers/marchand.pdf > > changing those numbers (the padding) has no positive effects...
If you apply a window at all, its span should be the same* as the actual (unpadded) data, not the width of the FFT. _______________________________ * Two greater is better if the ends of the window are zero. -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
MrBurnst wrote:
> >> > As I said, > first, I just use matlab's specgram method, which outputs one half of the > complex spectrum. On each window of the spectrum, I comute the magnitude > spectrum and apply the FFT, which in turn returns a complex spectrum, of > which I again compute the power spectrum, but only using the first 1024 > bins.... (??)
Isn't the DC term of the FFT of a magnitude spectrum proportional to the RMS of the initial signal? The rest of the terms are the variation in energy with frequency. Isn't that RMS usually a large term at that point? Dale B. Dalrymple
MrBurnst wrote:
> >> > >> > >> People ask all the time why a filter coefficient that theory supposes > to > >> be zero comes out to 3.084e-19, and wonder what's wrong with the > routine > >> that calculates it. Would you bet much that the values of -iab and > +iab, > >> separately calculated with floating point will sum to precisely zero? > >> No? I thought not. > >> > >> Jerry > > > >*OH NO* I'm agreeing with Jerry ;} > > > >I think you state the obverse to my perverse. > > > >Mr. Eisenberg > >should have said S conj(S) = |S|^2 > >which *may be* approached to limits of "numerical precision". > > > > > > Somehow I don't believe that differences in that order of magnitude (e-19) > are responsable for the behavior I'm observing. I have a really strong > (most of the time THE strongest in the spectrum) element in the 0est bin. > What I'm doing is taking the FFT of a FFT. Now, the first one has 512 > bins, and the resulting spectrum is zero-padded to a length of 2048. > Can this procedure somehow introduce some kind of offset? As I said, > first, I just use matlab's specgram method, which outputs one half of the > complex spectrum. On each window of the spectrum, I comute the magnitude > spectrum and apply the FFT, which in turn returns a complex spectrum, of > which I again compute the power spectrum, but only using the first 1024 > bins.... (??)
Matlab's spectrogram method produces the power spectrogram, i.e. a set of non-negaive real numbers. I will not be the least surprised if it turns out that the spectrum of such data is dominated by a strong DC component. Rune
>> >> Somehow I don't believe that differences in that order of magnitude
(e-19)
>> are responsable for the behavior I'm observing. I have a really strong >> (most of the time THE strongest in the spectrum) element in the 0est
bin.
>> What I'm doing is taking the FFT of a FFT. Now, the first one has 512 >> bins, and the resulting spectrum is zero-padded to a length of 2048. >> Can this procedure somehow introduce some kind of offset? As I said, >> first, I just use matlab's specgram method, which outputs one half of
the
>> complex spectrum. On each window of the spectrum, I comute the
magnitude
>> spectrum and apply the FFT, which in turn returns a complex spectrum,
of
>> which I again compute the power spectrum, but only using the first
1024
>> bins.... (??) > >Matlab's spectrogram method produces the power spectrogram, i.e. >a set of non-negaive real numbers. I will not be the least surprised if > >it turns out that the spectrum of such data is dominated by a strong >DC component. > >Rune >
Not true. Matlabs specgram method gives complex, negative and non-negative numbers. (when used with an ouput argument. Without output argument, it shows a "picture" of 20*log10(abs(spectrum)^2)). But you may be right about the dc-component. So I checked and substracted the mean of the spectrogram first, and then once again the mean from the FFT of the spectrogram, and that output looks - at least a little - better than before ... still, I'm not quite sure how to extract the f0 from that ...
MrBurnst wrote:

> Somehow I don't believe that differences in that order of > magnitude (e-19) are responsable for the behavior I'm observing.
My point was that the statement S = abs((S .* conj(S) / 512)).^2; in the script you posted basically gives the fourth power of the magnitude spectrum rather than the magnitude itself, which doesn't seem to appear in the paper from a cursory look. Still, it may not be the reason for your problems. Martin -- No wonder that illegitimate children are commonly the greatest minds; they are the result of an hour full of wit, marital ones often spring from boredom. --Theodor Gottlieb von Hippel
"dbd" <dbd@ieee.org> wrote in message 
news:1151388359.094915.65180@c74g2000cwc.googlegroups.com...
> > MrBurnst wrote: >> >> >> As I said, >> first, I just use matlab's specgram method, which outputs one half of the >> complex spectrum. On each window of the spectrum, I comute the magnitude >> spectrum and apply the FFT, which in turn returns a complex spectrum, of >> which I again compute the power spectrum, but only using the first 1024 >> bins.... (??) > > Isn't the DC term of the FFT of a magnitude spectrum proportional to > the RMS of the initial signal? The rest of the terms are the variation > in energy with frequency. Isn't that RMS usually a large term at that > point? > > Dale B. Dalrymple >
No, the DC term is the mean of the initial signal, or the sum of all the elements (N times the mean) depending on the details of the definition. Best wishes, --Phil Martel
>> >> Isn't the DC term of the FFT of a magnitude spectrum proportional to >> the RMS of the initial signal? The rest of the terms are the variation >> in energy with frequency. Isn't that RMS usually a large term at that >> point? >> >> Dale B. Dalrymple >> >No, the DC term is the mean of the initial signal, or the sum of all the
>elements (N times the mean) depending on the details of the definition. > > Best wishes, > --Phil Martel > >
That's what I thought. So, if I normalize my orignal signal to zero mean and compute the spectrum, I won't have a DC offset. So far so good. But even if I normalize the resulting spectrum (well, one frame of the spectrum at a time), I still get strong energy around the 0 component of the "spectrum of the spectrum" ... how can that be?
"MrBurnst" <ernst_schwartz@gmx.at> wrote in message 
news:VamdnXCTtp5YFD7ZnZ2dnUVZ_t2dnZ2d@giganews.com...
>>> >>> Isn't the DC term of the FFT of a magnitude spectrum proportional to >>> the RMS of the initial signal? The rest of the terms are the variation >>> in energy with frequency. Isn't that RMS usually a large term at that >>> point? >>> >>> Dale B. Dalrymple >>> >>No, the DC term is the mean of the initial signal, or the sum of all the > >>elements (N times the mean) depending on the details of the definition. >> >> Best wishes, >> --Phil Martel >> >> > > That's what I thought. > So, if I normalize my orignal signal to zero mean and compute the > spectrum, I won't have a DC offset. So far so good. But even if I > normalize the resulting spectrum (well, one frame of the spectrum at a > time), I still get strong energy around the 0 component of the "spectrum > of the spectrum" ... how can that be? >
Sorry, I don't have the original post. There might be leakage from low frequency terms or round-off problems. BTW, I assume you are treating the FTs you calculate and remove the DC term from as arrays of complex numbers and that you use a complex FFT for the second set of FTs. Best wishes, --Phil
earlier MrBurnst wrote:
=On each window of the spectrum, I comute the magnitude
=spectrum and apply the FFT, which in turn returns a complex spectrum,
of
=which I again compute the power spectrum, but only using the first
1024
=bins.... (??)
> >> > >> Isn't the DC term of the FFT of a magnitude spectrum proportional to > >> the RMS of the initial signal? > >> > >> Dale B. Dalrymple > >> > >No, the DC term is the mean of the initial signal, or the sum of all the > > >elements (N times the mean) depending on the details of the definition. > > > > Best wishes, > > --Phil Martel > >
MrBurnst If you are really calculating the magnitude spectrum of the first fft, as you said, the DC term of the magnitude spectrum of the first fft is the square root of the square of the sum of the inputs to the first fft. So, that would be the root-square-mean not root-mean-square (RMS) as I asked. Removing the average of the input data to the first fft should bring the DC term of the magnitude spectrum to zero. Most of the rest of the magnitude terms would be little effected. the DC output of the second fft would then still be large if the original data had significant AC content. Removing the magnitude calculation should significantly alter the results for most data inputs The problems mentioned earlier for the cepstrum calculation have been dealt with in some applications by use of the complex cepstrum in the 1980s and 1990s. The complex cepstrum added invertability to the toolkit, that is lacking with power or magnitude formulations.. Dale B. Dalrymple
dbd wrote:

   ...

> If you are really calculating the magnitude spectrum of the first fft, > as you said, the DC term of the magnitude spectrum of the first fft is > the square root of the square of the sum of the inputs to the first > fft. ...
Not so. Depending on scaling, the DC term is the sum of the inputs, their arithmetic mean, or something between. There is no squaring, rooting, or other non-linear operation involved. 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;