问题描述
我已经在StackOverflow上阅读了许多有关在加速度计数据上执行FFT的文章,但是它们都没有帮助我理解我的问题。
我正在执行),我能够解决自己的问题。解决方案几乎就是该链接中描述的内容。现在是我的图表:
低频伪像可能是由于缺少窗口。尝试应用窗口函数。
整体偏移可能是由于两种不同的FFT实现中的缩放比例不同所致-我的猜测是,您看到的偏移为24 dB对应的缩放比例差异为256。
I have read various posts here at StackOverflow regarding the execution of FFT on accelerometer data, but none of them helped me understand my problem.
I am executing this FFT implementation on my accelerometer data
array in the following way:
int length = data.size();
double[] re = new double[256];
double[] im = new double[256];
for (int i = 0; i < length; i++) {
input[i] = data[i];
}
FFT fft = new FFT(256);
fft.fft(re, im);
float outputData[] = new float[256];
for (int i = 0; i < 128; i++) {
outputData[i] = (float) Math.sqrt(re[i] * re[i]
+ im[i] * im[i]);
}
I plotted the contents of outputData
(left,) and also used R to perform the FFT on my data (right.)
What am I doing wrong here? I am using the same code for executing the FFT that I see in other places.
EDIT: Following the advice of @PaulR to apply a windowing function, and the link provided by @BjornRoche (http://baumdevblog.blogspot.com.br/2010/11/butterworth-lowpass-filter-coefficients.html), I was able to solve my problem. The solution is pretty much what is described in that link. This is my graph now: http://imgur.com/wGs43
The low frequency artefacts are probably due to a lack of windowing. Try applying a window function.
The overall shift is probably due to different scaling factors in the two different FFT implementations - my guess is that you are seeing a shift of 24 dB which corresponds to a difference in scaling by a factor of 256.
这篇关于FFT和加速度计数据:为什么得到此输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!