简体   繁体   中英

understanding jtransform

I want to do fft of an accelerometer data from android phone.I have chosen jtransform as fft library.Now I need some simple code to understand jtranform to write code to find fft from accelerometer data. Thanks in advance

Since you have the real data, you should pass these values to realForward function as stated here . When you pass the value array to this function it returns the results by overwriting this array with the FFT coefficients.

array = new double[arraySize];
...
DoubleFFT_1D dfft = new DoubleFFT_1D(arraySize);
dfft.realForward(array);

You should also consider the fact that output contains both real and imaginary parts:

if arraySize is even then

 array[2*k] = Re[k], 0 <= k < arraySize/2
 array[2*k+1] = Im[k], 0 < k < arraySize/2
 array[1] = Re[arraySize/2]

if arraySize is odd then

 array[2*k] = Re[k], 0 <= k < (arraySize+1)/2
 array[2*k+1] = Im[k], 0 < k < (arraySize-1)/2
 array[1] = Im[(arraySize-1)/2]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM