Fast Fourier Transformation question Topic is solved

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
Post Reply
User avatar
Sasari
New User
Posts: 2
Joined: Wed Jun 01, 2016 4:49 pm

Fast Fourier Transformation question

Post 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


View Solution
henk
Respected Member
Posts: 347
Joined: Wed Jan 27, 2016 5:21 pm

Post by henk »

Shouldn't you, in the new version, split the spectra afterwards?
User avatar
Sasari
New User
Posts: 2
Joined: Wed Jun 01, 2016 4:49 pm

Post by Sasari »

Yes, you're right.

thanks
User avatar
Thomas
Experienced Member
Posts: 66
Joined: Fri Feb 05, 2010 12:34 pm

Post 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
Post Reply