Page 1 of 1

Fast Fourier Transformation question

Posted: Thu Dec 01, 2016 5:49 pm
by Sasari
Hi,

question is about XMOS DSP library v3.0.0 and FFT function.
I was comparing the old library which uses two complex arrays to store FFT results and the new one (v3.0.0), which uses only one array, since I want to use the new one, because of the less memory usage.

As an example I used two real signals sig1(x) = 0.75*sin(x) and sig2(x) = 0.75 * cos(x).
  1. When old library was used, the function lib_dsp_fft_forward_tworeals transformed two real signals in frequency domain and results were :
    FFT output spectrum of signal 1:
    re, im
    0.0000000000, 0.0000000000
    0.0000000000, -0.3749999991
    0.0000000000, 0.0000000000
    0.0000000000, 0.0000000000
    0.0000000000, 0.0000000000
    0.0000000000, 0.0000000000
    0.0000000000, 0.0000000000
    0.0000000000, 0.3749999991

    FFT output spectrum of signal 2:
    re, im
    -0.0000000009, 0.0000000000
    0.3749999991, 0.0000000000
    -0.0000000009, 0.0000000000
    0.0000000000, 0.0000000000
    -0.0000000009, 0.0000000000
    0.0000000000, 0.0000000000
    -0.0000000009, 0.0000000000
    0.3749999991, 0.0000000000
  • When the new version of the library was used, functions dsp_fft_bit_reverse and dsp_fft_forward were used to save FFT results in one complex array:

    FFT output spectrum of signals
    re, im
    0.0000000000, -0.0000000009
    0.0000000000, 0.0000000000
    0.0000000000, -0.0000000009
    0.0000000000, 0.0000000000
    0.0000000000, -0.0000000009
    0.0000000000, 0.0000000000
    0.0000000000, -0.0000000009
    0.0000000000, 0.7499999981
When inverse FFT is done, in both cases (in old library by using lib_dsp_fft_inverse_tworeals, in the new library by using functions dsp_fft_bit_reverse and dsp_fft_inverse), real time signals are correct.

What's bugging me is the following (what I would expect): Every signal after FFT holds N samples of information. FFT results of the first signal should be in [0, N/2 -1] and of the second signal in [N/2, N-1] samples and in this case it doesn't look so or am I missing something ?

So the question is how (in what order) are stored FFT results, when doing FFT on two real signals simultaneously ?

Thank you

Re: Fast Fourier Transformation question

Posted: Thu Dec 01, 2016 5:53 pm
by henk
Shouldn't you, in the new version, split the spectra afterwards?

Re: Fast Fourier Transformation question

Posted: Thu Dec 01, 2016 6:02 pm
by Sasari
Yes, you're right.

thanks

Re: Fast Fourier Transformation question

Posted: Tue Dec 06, 2016 1:39 pm
by Thomas
I wanted to add a few details.
In version 3.0 of the library, when processing two real signals, the spectrum has to be split using the function dsp_fft_split_spectrum after dsp_fft_forward to get two complete real spectra.

This is shown in the example app_fft.xc