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.

How to get the real and imaginary parts from the FFT result?

Other Parts Discussed in Thread: CONTROLSUITE

Hi,

I am using TI's C28x Fixed Point DSP Library to do N points FFT with F28335, and the following is my code. My question is how to get the real and imaginary parts from the FFT result? Thanks a lot.

Biao

    //-------------------------------------------------------------------------------------------------
    // 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 */