Sign in

username:

password:



Not a member?

Search compdsp



Search tips

comp.dsp by Keywords

Adaptive Filter | ADPCM | ADSP | ADSP-2181 | Aliasing | AMR | Anti-Aliasing | ARMA | Autocorrelation | AutoCovariance | Beamforming | Bessel | Blackfin | Butterworth | C6713 | CCS | Chebyshev | CIC Filter | Circular Convolution | Code Composer Studio | Comb Filter | Compression | Convolution | Cross Correlation | DCT | Decimation | Deconvolution | Demodulation | DM642 | DSP Boards | DSP/BIOS | DTMF | Echo Cancellation | Equalization | Equalizer | ETSI | EZLITE (Ez-kit Lite) | FFT | FFTW | FIR Filter | Fixed Point | FSK | G.711 | G.723 | G.729 | Gaussian Noise | Goertzel | GPIO | Hilbert Transform | IFFT | IIR Filter | Interpolation | Invariance | JTAG | Kalman | Laplace Transform | Levinson | LPC | McBSP | MIPS | Modulation | MPEG | Multirate | Notch Filter | Nyquist | OFDM | Oversampling | Pink Noise | Pitch | PLL | Polyphase | QAM | QDMA | Quantization | Quantizer | Radar | Random Noise | Reed Solomon | Remez | Resampling | RTDX | Sampling | Sharc | TI C6711 | Undersampling | Viterbi | Wavelets | White Noise | Wiener Filter | Windowing | XDS510PP | Z Transform


Discussion Groups

Free Online Books

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | Comp.DSP | Newbie FFT normalization question

There are 10 messages in this thread.

You are currently looking at messages 0 to 10.


Newbie FFT normalization question - Yofnik - 2006-12-28 23:15:00

Hi All,
I am a software engineer, not a DSP guru. I have been using an open
source FFT algorithm for a project I am working on. As I have seen in a
number of examples, in order to get the results I expect, I need to
"normalize" the FFT results by dividing each value by N/2 (number of
samples / 2).

Can someone please give a little background as to why this is
necessary? I am not satisfied with just getting the expected results.
I'd like to have a better understanding of how they are derived.

Many thanks.

Yofnik

______________________________
DSPRelated.com's 50,000th member announced! Details Here.

Re: Newbie FFT normalization question - Rune Allnor - 2006-12-29 06:03:00



Yofnik skrev:
> Hi All,
> I am a software engineer, not a DSP guru. I have been using an open
> source FFT algorithm for a project I am working on. As I have seen in a
> number of examples, in order to get the results I expect, I need to
> "normalize" the FFT results by dividing each value by N/2 (number of
> samples / 2).

What do you expect? I assume you have an N length sinusoidal of
the form

x[n] = A sin(wn)

and find a spectrum coefficient of magnitude A*N/2 (provided
the frquency w is an integer fraction of the sampling frequency
w = m/N, m < N/2).

First the factor 1/2. The spectrum of a real-valued signal is
conjugate symmetric, meaning one real-valed sinusoidal is
represented as two complex-valued sinusoidals according
to Eulers formula,

A*sin(x) = A*(exp(jx)-exp(-jx))/j2.

These two complex-valued sinusoidals have magnitde
A/2, so if you plot only the range [0,fs/2] you need to
scale by a factor 2 to recover A.

Second, the factor N. The DFT is a set of vector products
between the input signal x and N complex elements of
unit magnitude:

X[k] = sum_n=0^N-1 A*exp(j*2*pi*k*n/N)*exp(-j*2*pi*k*n/N)
      = N*A

To recover A, one needs to divide by N.

Rune

______________________________
DSPRelated.com's 50,000th member announced! Details Here.

Re: Newbie FFT normalization question - Yofnik - 2006-12-29 10:09:00

Thanks Rune! This is exactly what I was looking for.


Rune Allnor wrote:
> Yofnik skrev:
> > Hi All,
> > I am a software engineer, not a DSP guru. I have been using an open
> > source FFT algorithm for a project I am working on. As I have seen in a
> > number of examples, in order to get the results I expect, I need to
> > "normalize" the FFT results by dividing each value by N/2 (number of
> > samples / 2).
>
> What do you expect? I assume you have an N length sinusoidal of
> the form
>
> x[n] = A sin(wn)
>
> and find a spectrum coefficient of magnitude A*N/2 (provided
> the frquency w is an integer fraction of the sampling frequency
> w = m/N, m < N/2).
>
> First the factor 1/2. The spectrum of a real-valued signal is
> conjugate symmetric, meaning one real-valed sinusoidal is
> represented as two complex-valued sinusoidals according
> to Eulers formula,
>
> A*sin(x) = A*(exp(jx)-exp(-jx))/j2.
>
> These two complex-valued sinusoidals have magnitde
> A/2, so if you plot only the range [0,fs/2] you need to
> scale by a factor 2 to recover A.
>
> Second, the factor N. The DFT is a set of vector products
> between the input signal x and N complex elements of
> unit magnitude:
>
> X[k] = sum_n=0^N-1 A*exp(j*2*pi*k*n/N)*exp(-j*2*pi*k*n/N)
>       = N*A
> 
> To recover A, one needs to divide by N.
> 
> Rune

______________________________
DSPRelated.com's 50,000th member announced! Details Here.

Re: Newbie FFT normalization question - Yofnik - 2007-01-16 18:08:00

Hi Rune,
I have another quick FFT newbie question. You did describe my scenario
accurately. The inputs to the FFT function are a set of voltage
readings sampled from a device. The customer wants the FFT output to be
in Volts RMS. How is that calculated?

Thanks again,

Yofnik

Rune Allnor wrote:
> Yofnik skrev:
> > Hi All,
> > I am a software engineer, not a DSP guru. I have been using an open
> > source FFT algorithm for a project I am working on. As I have seen in a
> > number of examples, in order to get the results I expect, I need to
> > "normalize" the FFT results by dividing each value by N/2 (number of
> > samples / 2).
>
> What do you expect? I assume you have an N length sinusoidal of
> the form
>
> x[n] = A sin(wn)
>
> and find a spectrum coefficient of magnitude A*N/2 (provided
> the frquency w is an integer fraction of the sampling frequency
> w = m/N, m < N/2).
>
> First the factor 1/2. The spectrum of a real-valued signal is
> conjugate symmetric, meaning one real-valed sinusoidal is
> represented as two complex-valued sinusoidals according
> to Eulers formula,
>
> A*sin(x) = A*(exp(jx)-exp(-jx))/j2.
>
> These two complex-valued sinusoidals have magnitde
> A/2, so if you plot only the range [0,fs/2] you need to
> scale by a factor 2 to recover A.
>
> Second, the factor N. The DFT is a set of vector products
> between the input signal x and N complex elements of
> unit magnitude:
>
> X[k] = sum_n=0^N-1 A*exp(j*2*pi*k*n/N)*exp(-j*2*pi*k*n/N)
>       = N*A
> 
> To recover A, one needs to divide by N.
> 
> Rune

______________________________
DSPRelated.com's 50,000th member announced! Details Here.

Re: Newbie FFT normalization question - Jeff Caunter - 2007-01-16 19:40:00

>The inputs to the FFT function are a set of voltage
>readings sampled from a device. The customer wants the FFT output to be
>in Volts RMS. How is that calculated?

Your signal would have passed through several stages of processing, both
analogue and digital, each with its own transfer characteristics. You have
two choices - dead-reckoning, or calibration. If you choose dead-reckoning,
you will still have to calibrate to prove your result.

Jeff
______________________________
DSPRelated.com's 50,000th member announced! Details Here.

Re: Newbie FFT normalization question - Yofnik - 2007-01-17 01:07:00

I am assuming the hardware guys are handling the calibration. They want
to see Volts RMS. Is there anything else I need to calcualte?


Jeff Caunter wrote:
> >The inputs to the FFT function are a set of voltage
> >readings sampled from a device. The customer wants the FFT output to be
> >in Volts RMS. How is that calculated?
>
> Your signal would have passed through several stages of processing, both
> analogue and digital, each with its own transfer characteristics. You have
> two choices - dead-reckoning, or calibration. If you choose dead-reckoning,
> you will still have to calibrate to prove your result.
> 
> Jeff

______________________________
DSPRelated.com's 50,000th member announced! Details Here.

Re: Newbie FFT normalization question - Rick Lyons - 2007-01-17 08:09:00

On 16 Jan 2007 22:07:58 -0800, "Yofnik" <y...@comcast.net> wrote:

>I am assuming the hardware guys are handling the calibration. They want
>to see Volts RMS. Is there anything else I need to calcualte?
>
>
>Jeff Caunter wrote:
>> >The inputs to the FFT function are a set of voltage
>> >readings sampled from a device. The customer wants the FFT output to be
>> >in Volts RMS. How is that calculated?
>>
>> Your signal would have passed through several stages of processing, both
>> analogue and digital, each with its own transfer characteristics. You have
>> two choices - dead-reckoning, or calibration. If you choose dead-reckoning,
>> you will still have to calibrate to prove your result.
>> 
>> Jeff

Hi,
  yes there is.  Let's assume:

* you're using a standard radix-2 FFT.
* your FFT input samples are real-only.
* FFT size is N = 1024.
* a single FFT-input sinewave has a peak 
  amplitude value of A1 = 20.
* the sinewave's frequency (as Rune said)
  is an integer multiple of Fs/N (where
  Fs is the data sample rate in Hz).

OK, the FFT magnitude for that sinewave will 
be M1 = A1*N/2 = 10240.  If the sinewave's 
peak amplitude were A2 = 40, then the
FFT magnitude for that new sinewave will 
be M2 = A2*N/2 = 20480.

So you can see that a sinewave's peak value
A (given the above assumptions) can be 
determined based on the N-point FFT's magnitude 
value M using:

         A = 2*M/N

So now you have to go to the hardware guys 
and ask them, "What is the rms voltage of an 
analog sinewave that will show up at my FFT's 
input having a peak amplitude of 20?"  If they 
tell you that a 0.7 volt-rms sinewave will show 
up at your FFT's input having a peak value of 20, 
then you know an FFT magnitude of M = 10240 
represents a 0.7 volt-rms sinewave.

Likewise, a 1.4 (2*0.7) volt-rms analog sinewave 
should yield an FFT magnitude of M = 20480.  So there 
you have it.  An analog sinewave's rms voltage 
will be:

       Voltage = (M*0.7)/10240  volts-rms

OK Yofnik, now you "play it safe".  Ask the 
hardware guys to carefully and precisely generate 
an analog sinewave whose voltage is 0.7 volts-rms.
Now, make sure your FFT magnitude is M = 10240.
Next have the hardware guys generate 
an analog sinewave whose voltage is 1.4 volts-rms 
and make sure your FFT magnitude is M = 20480.
Do *NOT* fail to perform this "calibration" exercise.
It will help you to sleep better at night.

Good Luck,
[-Rick-]

______________________________
DSPRelated.com's 50,000th member announced! Details Here.

Re: Newbie FFT normalization question - Yofnik - 2007-01-17 21:46:00

Thanks Rick. This helps a lot. Let me see if I understand this
correctly.

Right now, the software I am developing is displaying the FFT graph. I
am currently plotting the magnitude of each FFT point after I multiply
by 2*M/N (as Rune originally explained why).

So if I understand your reply correctly, I need to take the "known" RMS
value and calibrate my reponse accordingly as you described -
(M*0.7)/10240. (actual value to be determined).

The one thing I still want to understand is how they will be able to
answer the question you provided:
"What is the rms voltage of an analog sinewave that will show up at my
FFT's input having a peak amplitude of 20?"

How is this determined?

Thanks to all for your help.

Yofnik

Rick Lyons wrote:
> On 16 Jan 2007 22:07:58 -0800, "Yofnik" <y...@comcast.net> wrote:
>
> >I am assuming the hardware guys are handling the calibration. They want
> >to see Volts RMS. Is there anything else I need to calcualte?
> >
> >
> >Jeff Caunter wrote:
> >> >The inputs to the FFT function are a set of voltage
> >> >readings sampled from a device. The customer wants the FFT output to be
> >> >in Volts RMS. How is that calculated?
> >>
> >> Your signal would have passed through several stages of processing, both
> >> analogue and digital, each with its own transfer characteristics. You have
> >> two choices - dead-reckoning, or calibration. If you choose dead-reckoning,
> >> you will still have to calibrate to prove your result.
> >>
> >> Jeff
>
> Hi,
>   yes there is.  Let's assume:
>
> * you're using a standard radix-2 FFT.
> * your FFT input samples are real-only.
> * FFT size is N = 1024.
> * a single FFT-input sinewave has a peak
>   amplitude value of A1 = 20.
> * the sinewave's frequency (as Rune said)
>   is an integer multiple of Fs/N (where
>   Fs is the data sample rate in Hz).
>
> OK, the FFT magnitude for that sinewave will
> be M1 = A1*N/2 = 10240.  If the sinewave's
> peak amplitude were A2 = 40, then the
> FFT magnitude for that new sinewave will
> be M2 = A2*N/2 = 20480.
>
> So you can see that a sinewave's peak value
> A (given the above assumptions) can be
> determined based on the N-point FFT's magnitude
> value M using:
>
>          A = 2*M/N
>
> So now you have to go to the hardware guys
> and ask them, "What is the rms voltage of an
> analog sinewave that will show up at my FFT's
> input having a peak amplitude of 20?"  If they
> tell you that a 0.7 volt-rms sinewave will show
> up at your FFT's input having a peak value of 20,
> then you know an FFT magnitude of M = 10240
> represents a 0.7 volt-rms sinewave.
>
> Likewise, a 1.4 (2*0.7) volt-rms analog sinewave
> should yield an FFT magnitude of M = 20480.  So there
> you have it.  An analog sinewave's rms voltage
> will be:
>
>        Voltage = (M*0.7)/10240  volts-rms
>
> OK Yofnik, now you "play it safe".  Ask the
> hardware guys to carefully and precisely generate
> an analog sinewave whose voltage is 0.7 volts-rms.
> Now, make sure your FFT magnitude is M = 10240.
> Next have the hardware guys generate
> an analog sinewave whose voltage is 1.4 volts-rms
> and make sure your FFT magnitude is M = 20480.
> Do *NOT* fail to perform this "calibration" exercise.
> It will help you to sleep better at night.
> 
> Good Luck,
> [-Rick-]

______________________________
DSPRelated.com's 50,000th member announced! Details Here.

Re: Newbie FFT normalization question - Rick Lyons - 2007-01-18 09:03:00

On 17 Jan 2007 18:46:01 -0800, "Yofnik" <y...@comcast.net> wrote:

>Thanks Rick. This helps a lot. Let me see if I understand this
>correctly.
>
>Right now, the software I am developing is displaying the FFT graph. I
>am currently plotting the magnitude of each FFT point after I multiply
>by 2*M/N (as Rune originally explained why).
>
>So if I understand your reply correctly, I need to take the "known" RMS
>value and calibrate my reponse accordingly as you described -
>(M*0.7)/10240. (actual value to be determined).
>
>The one thing I still want to understand is how they will be able to
>answer the question you provided:
>"What is the rms voltage of an analog sinewave that will show up at my
>FFT's input having a peak amplitude of 20?"
>
>How is this determined?
>
>Thanks to all for your help.

Hi,
You are welcome.

OK Yofnik, the answer to your last question depends 
on: (1) any analog amplifiers/antenuators at the 
analog-input of your system, (2) the analog-to-digital 
converter's (A/D) input voltage range, (3) the number 
of bits output by the A/D, and (4) the binary 
number format output by the A/D.  The hardware guys 
on your project will be able to, very quickly, explain 
the entire situation to you.

Good Luck,
[-Rick-]

______________________________
DSPRelated.com's 50,000th member announced! Details Here.

Re: Newbie FFT normalization question - Rune Allnor - 2007-01-18 10:04:00

Yofnik skrev:
> Thanks Rick. This helps a lot. Let me see if I understand this
> correctly.
>
> Right now, the software I am developing is displaying the FFT graph. I
> am currently plotting the magnitude of each FFT point after I multiply
> by 2*M/N (as Rune originally explained why).
>
> So if I understand your reply correctly, I need to take the "known" RMS
> value and calibrate my reponse accordingly as you described -
> (M*0.7)/10240. (actual value to be determined).

Correct. First apply a known signal to the system and decide the
scaling factor that makes the numbers come out correctly on the
screen.

> The one thing I still want to understand is how they will be able to
> answer the question you provided:
> "What is the rms voltage of an analog sinewave that will show up at my
> FFT's input having a peak amplitude of 20?"
>
> How is this determined?

By trial and error.

Use the numbers that popped out of the first calibration run to
estimate what voltage you will need to get that number (or another
reasonable RMS voltage number) on the screen. Then set the
signal source to that value and see if it works. 

Rune

______________________________
DSPRelated.com's 50,000th member announced! Details Here.