Re: Magnitudes drop when adding more



>
>"overgaard" <jorgen@xxxxxxxxxxxxx> wrote in message
>news:rISdnc0GibpOXUHeRVn-qQ@xxxxxxxxxxxxxxx
>> Hi,
>>
>> I've just "restarted" my interest in DSP and mainly FFT.
>> I'm using FFTW which I think is absolutely amazingly good! :)
>>
>> I was playing around with FFT a few years back and I think I
>> remember stumbled on this problem back then too. The sad
>> part is - I don't remember if I solved it or not back then.
>> (what good memory, eh? hehe)
>>
>> Anyway, I'm troubled with something I quite can't figure out.
>> I've done a test application that generates sinewaves and stores them
>> to a WAV-file. When I open the WAV-file and run FFTW on it and plot
>> a spectrum of it, it looks fine on frequency. BUT the magnitudes are
>> behaving strangely. If I have a single tone, lets say at 1000 Hz
>> it show up at full scale. If I add one more tone, they BOTH drop in
>> magnitude. To doublecheck I opened the WAV file i Audacity and looked
att
>> the spectrum there. It looks fine there even if I add three tones or
>> more.
>> But in my application, the more tones I add, the lower they ALL get.
>> Why is this? (ripping the hair of my head)
>>
>> I'm using real to complex FFTW, eg. fftw_plan_dft_r2c_1d
>> and I am calculating the magnitudes with
>>
sqrt((in_complex[i][0]*in_complex[i][0])+(in_complex[i][1]*in_complex[i][1]))*Normalize
>>
>> which should translate to
>>
>> Magnitude = sqrt(re^2 + im^2) * Normalize
>>
>> My normalizing is
>>
>> Normalize = (sqrt(1.0/FFT_SIZE)) * (sqrt(1.0/FFT_SIZE));
>>
>> I've tried a lot of "normalizers" (searched Comp.DSP) but I'm not a
100
>> percent sure this is the "right" normalizing.
>>
>> Anyone has any idea why the magnitudes drop the more tones I add?
>> And of course, please tell me something about how to normalize
correctly.
>> If I have a sine at 1000 Hz which peaks(-1.0 to 1.0) it would be
>> nice to get the spectrum to show about 1.0 in magnitude at the bin
>> for 1000 Hz.
>>
>> Best regards // Jörgen
>
>Jörgen,
>
>First of all, the normalization is up to you really.
>The most common normalization in DSP is NO normalization in the FFT and
1/N
>normalization in the IFFT.
>FFTW doesn't do that for you as I recall.
>1/sqrt(N) in both directions is more typically used by physicists I
believe.
>Another variation is 1/N in the FFT.
>
>For one unit cosine of some integer number of periods in the temporal
epoch,
>what you should get are a *pair* of real frequency samples of magnitude
N/2
>each if there is no scaling in the FFT. So, if you want to see
magnitudes
>of 1.0 for each frequency sample of a unit cosine in time, you should
>multiply the fft by 2/N and the ifft by N/2 (assuming that it is already

>normalized by 1/N) or by 1/2 if it's not scaled that way.
>
>In other words:
>Scale the FFTW IFFT by 1/N as a "normal thing" in order to switch from
one
>transform space to another without worries - unless you're changing the
>value of N in there somewhere.
>
>Then, if you want to have some other normalization "on top" of that,
>normalize in both directions (inversely) according to what you want.
>So, that would be 2/N for the fft and N/2 for the ifft if you want unit
>cosines to have each sample in frequency of mangitude 1.0.
>
>For a sum of one unit cosines of some integer number of periods each in
the
>temporal epoch, there will be no change to the above. That is, unless
you
>change N and the scaling changes accordingly!
>
>Fred
>
>
>

Hi Fred and thanks for answering my "call"! :)

Very interresting information you supplied me with. Much appreciated! =)
Normalization with (2.0/N) does it perfectly now! Finally, Yes!

Again, thanks for your reply!

Best regards // Jörgen
.



Relevant Pages

  • Re: Magnitudes drop when adding more
    ... > I'm using FFTW which I think is absolutely amazingly good! ... > I was playing around with FFT a few years back and I think I ... BUT the magnitudes are ... the normalization is up to you really. ...
    (comp.dsp)
  • Magnitudes drop when adding more
    ... I'm using FFTW which I think is absolutely amazingly good! ... I was playing around with FFT a few years back and I think I ... BUT the magnitudes are ... But in my application, the more tones I add, the lower they ALL get. ...
    (comp.dsp)
  • manipulating fft
    ... % Can anyone explain the normalization required for directly manipulating ... using fft to calculate the derivative of sin: ... % through ifft, as well as needing the factor of pi (does fft need Hz ...
    (comp.soft-sys.matlab)
  • Re: Spectrum analysis question
    ... better for us to average FFT magnitudes or average the squares of the ... disappear by offsetting the FFT frames so that the signal ... out across frames due to phase rotation. ...
    (comp.dsp)
  • Re: Fast Convolution: does it matter whether I normalize to block length (N) in the FFT versus in th
    ... >>> Right, but when I'm doing fast convolution, I'm multiplying the result ... >>> where my normalization is in the iFFT. ... > I'm not sure what you mean by "unproperly scaled" version of the FFT. ... > Let FFT' be the FFT without ANY normalization to N. ...
    (comp.dsp)