FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > DSP

DSP comp.dsp newsgroup, mailing list

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-12-2008, 04:28 AM
tonga
Guest
 
Posts: n/a
Default determing the scaling factor

I'm writing some code for power spectral estimation using FFT. The dat
format I used is Q15 fixed point format. Since I need to scale the origina
signal within the Q15 range between -1~0.9999, I need to choose a prope
scaling factor for the original data sequence. But how can I choose thi
scaling factor so that it does not cause overflow, nor does it caus
underflow? I tried several different values for this scaling factor but i
either resulted in overflow or underflow. I guess the reason is because th
power spectrum involves with successive accumulation of square magnitude o
FFT output, which may easily goes beyond [-1,1) range. But I don't know ho
to select this scaling factor in my case. Anyone has idea on this?


Reply With Quote
  #2 (permalink)  
Old 08-12-2008, 01:00 PM
John
Guest
 
Posts: n/a
Default Re: determing the scaling factor

On Aug 11, 10:28 pm, "tonga" <binwei_w...@hotmail.com> wrote:
> I'm writing some code for power spectral estimation using FFT. The data
> format I used is Q15 fixed point format. Since I need to scale the original
> signal within the Q15 range between -1~0.9999, I need to choose a proper
> scaling factor for the original data sequence. But how can I choose this
> scaling factor so that it does not cause overflow, nor does it cause
> underflow? I tried several different values for this scaling factor but it
> either resulted in overflow or underflow. I guess the reason is because the
> power spectrum involves with successive accumulation of square magnitude of
> FFT output, which may easily goes beyond [-1,1) range. But I don't know how
> to select this scaling factor in my case. Anyone has idea on this?


You should divide each input sample by 32768 before windowing.
The window should be floating point between [-1,1].
The window should sum to one if you are looking for accurate tone
power.
Check the scaling performed by the forward FFT.
Divide each FFT mag^2 value by the total number of FFTs performed
before accumulating.
For a bin centered pure tone input, you should get a result of 1 == 0
dBFS at the the expected bin.

John
Reply With Quote
  #3 (permalink)  
Old 08-12-2008, 02:02 PM
dbell
Guest
 
Posts: n/a
Default Re: determing the scaling factor

On Aug 11, 10:28*pm, "tonga" <binwei_w...@hotmail.com> wrote:
> I'm writing some code for power spectral estimation using FFT. The data
> format I used is Q15 fixed point format. Since I need to scale the original
> signal within the Q15 range between -1~0.9999, I need to choose a proper
> scaling factor for the original data sequence. But how can I choose this
> scaling factor so that it does not cause overflow, nor does it cause
> underflow? I tried several different values for this scaling factor but it
> either resulted in overflow or underflow. I guess the reason is because the
> power spectrum involves with successive accumulation of square magnitude of
> FFT output, which may easily goes beyond [-1,1) range. But I don't know how
> to select this scaling factor in my case. Anyone has idea on this? *


If you are writing or have access to the actual FFT code you can
incorporate fixed or conditional scaling at each stage of the FFT. For
example a standard radix-2 algorithm has a max gain at each stage of
2. At the output of each stage you could scale down by 2 to offset the
gain. Alternately, check the numbers at each stage, do the scaling
conditionally, and incorporate the net scaling in the final output
(possibly only by noting the scaling error, not actually scaling the
numbers). Also take a look at conditional block scaling. Probably find
all of this in Rabiner and Gold's DSP book from the 70's. Maybe
someone else could recommend a later book.

Dirk
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scaling Factor In Approximating Continuous-time Convolution byDiscrete-time Convolution sunny DSP 3 01-11-2008 05:16 PM
Scaling factor in inverse fourier transform Titi Anggono DSP 3 04-11-2007 08:47 AM
How do I deal with final scaling factor in 8K FFT? Mr. Ken DSP 1 01-24-2007 03:20 AM
a question about image filtering: what should be the scaling factor after image filtering? lucy DSP 1 11-27-2004 05:52 PM
correct scaling factor in Matlab cwt()? Christopher John Rozell DSP 0 07-25-2003 05:31 PM


All times are GMT +1. The time now is 01:38 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved