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.

CCS/LAUNCHXL-F28379D: FFT magnitude function calculation: CFFT_f32s_mag_TMU0 function

Part Number: LAUNCHXL-F28379D

Tool/software: Code Composer Studio

Hi all,

I'm using CFFT_f32s_mag_TMU0 function to calculate the FFT magnitude of a pretty simpe waveform which contains 1Hz and 3Hz components. As attached below, the graph shows a clear result:

And what the function gives me is:

In the function documentation it says:

The output from CFFT_f32s_mag matches the magnitude output from the FFT found in common mathematics software and Code Composer Studio FFT graphs.

But it seems not. So my question is:

  1. Why the result is inconsistent?
  2. Why would negeative number appears, since the magnitude should calculate sqrt(Xre[i]2 + Xim[i]2).

Any relpy is appreciated.

Best Regards

Ethan

  • Hi all,

    The first quesiton was resolved. I did not pass the imaginary part into the CFFT. But I'm still curious why would the magnitude function gives negative result.

  • Hi,

    Few assumptions that needs to hold true before call this function are:

    • CFFT_f32() has been called prior to this function
    • Stages must be at least 3 (FFTSize >= 8)
    • FFTSize must be at least 8 and even.

    Please check all the above three conditions are valid. Also note that the magnitude result pointer after computation is stored in CurrentOutPtr so make use of CFFT_f32_getCurrOutputPtr() to access the result pointer.

    If my reply answers your question please click on "This resolved my issue" button located at the bottom of my post.

    Regards

    Himanshu

  • Hi Himanshu,

    I've checked all above points and the size of FFT is 32. And I do not think this is related to the second question. Anyway, thanks for the response.

    Best Regards

    Ethan

  • Sure, Please let us know if you are able to resolve the issue based on the above inputs.

    If my reply answers your question please click on "This resolved my issue" button located at the bottom of my post.

    Regards

    Himanshu