简体   繁体   English

根据加速度计数据,使用Android中的Libgdx标准化fft的输出

[英]Normalize output of fft using Libgdx in Android, from accelerometer data

I use the FFT function from the Libgdx library for a project in Android, where I process the accelerometer signal for create a signal spectrum. 我将Libgdx库中的FFT函数用于Android中的一个项目,在这里我处理加速度计信号以创建信号频谱。

I need to normalize the output from accelerometer data, i read there isn't a "correct" way to do this but is conventional. 我需要对加速度计数据的输出进行归一化,我读到没有“正确”的方法可以做到这一点,但是很传统。 Someone use dividing by 1/N in FFT, other by 1/sqrt(N). 有人在FFT中使用1 / N除法,其他人使用1 / sqrt(N)除法。

I didn't understand if this is conventional for who implements the library, this mean that every library have his normalization factor, or is conventional for the user than I can decide for aesthetic representation. 我不了解这对于实施该库的人来说是否是常规的,这意味着每个库都有他的归一化因子,或者对于用户而言是常规的,因此我无法决定美观表示法。

If it depends on library, which is the normalization factor for FFT in LIBGDX library? 如果取决于库,那么LIBGDX库中FFT的归一化因子是什么?

Edit1: I searched already inside documentation but I found nothing. Edit1:我已经在文档内部进行搜索,但是什么也没找到。 Here is it: http://libgdx-android.com/docs/api/com/badlogic/gdx/audio/analysis/FFT.html 就是这里: http : //libgdx-android.com/docs/api/com/badlogic/gdx/audio/analysis/FFT.html

I was about to say "just check the documentation", but it turns out that it's terrible, and doesn't say one way or the other! 我本来要说“只是检查文档”,但事实证明这很糟糕,并且没有说任何一种!

Still, you could determine the scale factor empirically. 不过,您可以凭经验确定比例因子。 Just run an FFT on all-ones dataset. 只需对全集数据集运行FFT。 There will be one non-zero bin in the output. 输出中将有一个非零bin。 There are three likely values of this bin: 此bin可能有三个值:

  • 1.0: The scale was 1/N 1.0:比例为1 / N
  • sqrt(N): The scale was 1/sqrt(N) sqrt(N):比例为1 / sqrt(N)
  • N: The scale was 1 N:比例为1

You can do the same trick for the inverse FFT, although it's redundant. 您可以对逆FFT进行相同的操作,尽管这是多余的。 The forward and inverse scale factors must multiply to 1/N. 正向和反向比例因子必须乘以1 / N。

There's a specific normalization depending on if you want the spectrum or power spectral density. 有一个特定的归一化取决于您是否想要频谱或功率频谱密度。 Oli provided a good test for determining the 1/N, 1/sqrt(N) or no scaling that the library performs. Oli提供了一个很好的测试来确定库执行的1 / N,1 / sqrt(N)或不进行缩放。

Here's a document that explains everything in great detail along with a comprehensive comparison of window functions. 这是一份文档,其中详细介绍了所有内容以及窗口功能的全面比较。

http://edoc.mpg.de/395068 http://edoc.mpg.de/395068

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

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