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.

Real FFT to Magnitude (and Phase) in DSPLib?



I see support for Real FFT in DSPLib as rfft().  Understandably, rfft() takes real data on input, but provide complex data on output as real plus imaginary pairs, much like other FFT libraries.  I also see various other Q.15 library calls for vector multiply.  What seems to be missing, however, is an easy call to convert the complex output of the *fft() routines from rectangular to polar coordinates.  I think I saw a routine which could calculate the phase, but my application does not need phase.  There is a vector power() routine, but it produces a scalar output, and does not take complex data on input anyway.

What would be handy is a rectangular-to-polar vector conversion which take complex input (real+imag) and produces pseudo-complex output (magn+phas).  For efficiency, it would be great to be able to skip the phase and just produce a magnitude vector from complex input.

Does anything like this exist in the DSPLib or math library support for the C55x DSP?

P.S.  I'm developing for the C5506, but I assume the answer is the same for the entire C55x family.

  • I agree, a function to convert from complex FFT to abs(FFT) would be very useful - at present I will have to work out how to achieve it by combining existing functions...

  • Be sure to look out for errors in dspLib which might affect your results.

    You'll need to square the real and imaginary components, sum the pairs, and then calculate the square root.  'square' is easy since you can use the multiply function and simply provide the same address for each input, therefore calculating the square of the input.  'sum' of each pair is not readily available, but it is easy to write on your own.  'square root' is available in dspLib, but there are serious errors in the code provided.  Look elsewhere on this forum, as well as the Wiki, for my comments on exactly what the errors are and how to fix them.  As you can probably tell, I eventually solved my own needs with an efficient, custom routine, but I still suggest that Texas Instruments provide something similar.

  • Hi,

    I have been trying to calculate phase of the principal component of the input signal. But i am not able to get the correct answer.

    I have posted my problem in :

    http://e2e.ti.com/support/dsp/c5000/f/109/t/253665.aspx

    Could you please have a look