简体   繁体   中英

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.

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).

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?

Edit1: I searched already inside documentation but I found nothing. Here is it: 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. There will be one non-zero bin in the output. There are three likely values of this bin:

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

You can do the same trick for the inverse FFT, although it's redundant. The forward and inverse scale factors must multiply to 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.

Here's a document that explains everything in great detail along with a comprehensive comparison of window functions.

http://edoc.mpg.de/395068

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