AnsweredAssumed Answered

Power spectrum with meaningful levels

Question asked by sauwen on Jan 26, 2011
Latest reply on Mar 1, 2011 by gpan



I am trying to produce a power spectrum with meaningful levels on the dsp.  This is similar to MATLAB's reference:


My problem is that I want to utilize the fract16 datatype or use a 16-bit fixed point representation and avoid using floating point for efficiency.  After I do

rfft_fr16(input, output, twiddle_table, 1, FFT_SIZE, &block_exponent, 1); //get fft


  power_fp[i] = output[i].re*output[i].re + output[i].im*output[i].im;  //this may overflow even when no scaling is done..
                           //beware, results of overflow becomes negative number


What happens is that even before I scale anything, my output has overflowed.


I believe I may be missing a crucial step though.. converting from fr16 fractional values from -1 to 1 to fixed point values -32768 to 32767.  I can't just insert the values given to me into the -1 to 1 of my fixed point representation or else I'll be losing a lot of information.  The easy (cop out) way would be to do this:



and the divide by the 2^(fractional bits) to obtain my fixed point value.  That would involve changing back to float.  Would this be my only option?  Am I on track or way off?  Any suggestions are most welcome.


Thank you