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
|