This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

调用controlsuilt的定点FFT库计算512点FFT,请问怎么将输出的幅值还原成真实值?

我用的28335,调用controlsuilt的定点FFT库例程计算512点FFT,代码如下,输出的是幅值的平方,而且是Q30格式,

fft.mag(&fft);        /* Q31 format (abs(ipcbsrc)/2^16).^2 */  ,   请问怎么将输出的幅值还原成真实值?
//######################################################################################
// $TI Release: C28x Fixed Point Library v1.01 $
// $Release Date: January 11,2011 $
//######################################################################################

#include "DSP28x_Project.h"
#include <fft.h>
#include "math.h"
#include "float.h"
   
/* Create an Instance of FFT module   */
#define     N   512 								// FFT size

#pragma DATA_SECTION(ipcb, "FFTipcb");			// Input/output memory allocation
#pragma DATA_SECTION(ipcbsrc, "FFTipcbsrc");   
long ipcbsrc[2*N];								
long ipcb[2*N];  

RFFT32  fft=RFFT32_512P_DEFAULTS;  				// Header structure definition

/* Define window Co-efficient Array  and place the
.constant section in ROM memory				*/
const long win[N/2]=HAMMING32;   				// Select window, not used in this example
   
int xn,yn;										

float	RadStep = 0.1963495408494f;				// Simulated signal generation parameter
float	Rad = 0.0f;								// Initial value of Radstep

void main()
{    
	    unsigned long i;
	     
	    InitSysCtrl();
		DINT;
		InitPieCtrl();
		IER = 0x0000;
		IFR = 0x0000;
		InitPieVectTable();
		EINT;   // Enable Global interrupt INTM
		ERTM;   // Enable Global realtime interrupt DBGM
	          
        // Generate sample waveforms:
		Rad = 0.0f;		

		//Clean up input/output buffer
		for(i=0; i < (N*2); i=i+2)
		{
		ipcb[i]  =0;          
		ipcb[i+1] = 0;    
		}

		//Simulated input signal
		for(i=0; i < N; i++)
		{
		ipcbsrc[i]  =(long)(2147483648*(sin(Rad) + cos(Rad*2.3567))/2);  //Q31
		Rad = Rad + RadStep;
		}

/*---------------------------------------------------------------------------
    	FFT Calculation           
----------------------------------------------------------------------------*/
		RFFT32_brev(ipcbsrc, ipcb, N);	/* real FFT bit reversing   */

		fft.ipcbptr=ipcb;				/* FFT computation buffer	*/
		fft.magptr=ipcbsrc;				/* Magnitude output buffer	*/
		fft.winptr=(long *)win;     	/* Window coefficient array */
		fft.init(&fft);    				/* Twiddle factor pointer initialization  */

		fft.calc(&fft);					/* Compute the FFT			*/
		
		fft.mag(&fft);         			/* Q31 format (abs(ipcbsrc)/2^16).^2 */
		
		//asm("   ESTOP0");
		for(;;);

} /* End: main() */