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.

TMS320F28374S: RFFT/IRFFT performing an inverse discrete fourier transform for a real signal

Part Number: TMS320F28374S
Other Parts Discussed in Thread: C2000WARE

Hello,

I have succesfully used the RFFT function (FPU) to transform an array (real valued signal) to the frequency domain.
After manipulating the spectrum, I would like to return to the time domain, however no such function (IRFFT?) is available.
On a Texas forum I have read it is possible to use the RFFT function to perform the inverse discrete fourier transform.
I have tried to implement this, but without succes.

Here below I show the procecudure I use for a 4 point FFT.
(I realise the number of points should be at least 32 for the RRFT)

Procedure:
----------

Step 1) Swap the real and imaginary parts of the spectrum array(result of the FFT on a real valued signal)

                                        RFFT result
 
array index:     0            1            2         3          4          5             6            7
array value:  real[0]   real[1]   real[2]  real[3]  real[4]   imag[3]   imag[2]  imag[1]


                            RFFT result after swapping the array

array index:     0           1              2           3            4          5           6          7
array value:  real[0]   imag[1]   imag[2]  imag[3]  real[4]   real[3]   real[2]  real[1]

The DC component (real[0]) and the Nyquist component (real[4]) remain in the same array position.

Step 2) Perform the FFT on the swapped array.
Step 3) Swap the array again as shown in step 1).

However this does not yield the correct results. Any help would be appreciated.


Also I would like to reconstruct the real/imag spectrum array from the magnitude (RFFT_f32_mag_TMU0) and the phase(RFFT_f32_phase_TMU0) results.
                             
                              magnitude results 
magnitude array index:     0            1            2           3            4        
magnitude array value:    DC      mag[1]   mag[2]  mag[3]   Nyquist

                              phase results
phase array index:     0       1                 2             3                
phase array value:     0    phase[1]  phase[2]  phase[3]  

Would it be possible to confirm if the following reconstruction is correct?

real[0] = DC
real[1] = mag[1]*cos(phase[1])
real[2] = mag[2]*cos(phase[2])
real[3] = mag[3]*cos(phase[3])
real[4] = Nyquist
imag[3] = mag[3]*sin(phase[1])
imag[2] = mag[2]*sin(phase[2])
imag[1] = mag[1]*sin(phase[3])

Thank you!

Kind regards,
Maarten

  • TMS320F28374S: RFFT/IRFFT performing an inverse discrete fourier transform for a real signal

    Prodigy 10 points
    Maarten Lietaert

    Replies: 0

    Views: 4

    Part Number: TMS320F28374S

    Hello,

    I have made some corrections and clarifications to my original question:

    I have succesfully used the RFFT function (FPU) to transform an array (real valued signal) to the frequency domain.
    After manipulating the spectrum, I would like to return to the time domain, however no such function (IRFFT?) is available.
    On a Texas forum I have read it is possible to use the RFFT function to perform the inverse discrete fourier transform.
    I have tried to implement this, but without succes.

    Here below I show the procecudure I use for a RFFT on an array of 8 (floating point) samples.

    (I realise the number of points should be at least 32 for the RFFT)

    Procedure:
    ----------

    Step 1) Swap the real and imaginary parts of the spectrum array(result of the FFT on a real valued signal)

                                            RFFT result
     
    array index:     0            1            2         3          4          5             6            7
    array value:  real[0]   real[1]   real[2]  real[3]  real[4]   imag[3]   imag[2]  imag[1]


                                RFFT result after swapping the array

    array index:     0           1              2           3            4          5           6          7
    array value:  real[0]   imag[1]   imag[2]  imag[3]  real[4]   real[3]   real[2]  real[1]

    The DC component (real[0]) and the Nyquist component (real[4]) remain in the same array position.

    Step 2) Perform the RFFT on the swapped array.
    Step 3) Swap the array again as shown in step 1).

    However this does not yield the correct results. Any help would be appreciated.


    Also I would like to reconstruct the real/imag spectrum array from the magnitude (RFFT_f32_mag_TMU0) and the phase(RFFT_f32_phase_TMU0) results.
                                 
                                  magnitude results 
    magnitude array index:     0            1            2           3            4        
    magnitude array value:    DC      mag[1]   mag[2]  mag[3]   Nyquist

                                  phase results
    phase array index:     0       1                 2             3                
    phase array value:     0    phase[1]  phase[2]  phase[3]  

    Would it be possible to confirm if the following reconstruction is correct?

    real[0] = DC
    real[1] = mag[1]*cos(phase[1])
    real[2] = mag[2]*cos(phase[2])
    real[3] = mag[3]*cos(phase[3])
    real[4] = Nyquist
    imag[3] = mag[3]*sin(phase[1])
    imag[2] = mag[2]*sin(phase[2])
    imag[1] = mag[1]*sin(phase[3])

    Thank you!

    Kind regards,
    Maarten

  • Maarten,

    C2000Ware does have an irfft implementation at C2000Ware_2_00_00_02\libraries\dsp\FPU\c28\examples\fft.

    Will this not work for you?

    Thanks,

    Sira

  • Sira,

    Thank you for your suggestion, I will look into this. I will let you know if this solves my issue.

    Thank you!

    Kind regards,

    Maarten