简体   繁体   English

理解jtransform

[英]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. 我想从android手机做fft加速计数据。我选择了jtransform作为fft库。现在我需要一些简单的代码来理解jtranform编写代码来从加速度计数据中找到fft。 Thanks in advance 提前致谢

Since you have the real data, you should pass these values to realForward function as stated here . 既然你有真实的数据,你应该通过这些值realForward作为所述功能在这里 When you pass the value array to this function it returns the results by overwriting this array with the FFT coefficients. 将值数组传递给此函数时,它会通过使用FFT系数覆盖此数组来返回结果。

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 如果arraySizearraySize的话

 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 如果arraySize是奇数那么

 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]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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