1

I am developing an android app that will do human activity recognition. I am using Apache Commons to calculate my time domain features already. Now, I want to use Fast Fourier Transform method of the library to convert my time domain data (raw xyz values) from the accelerometer to the frequency domain. I am not sure how to interpret the result. Am I correct to interpret the result as a bin corresponding to each of the frequency for the values of X (for example) at each of those frequencies?

This is the code I have:

public class MyFFT {

public static void computeFFT(double[] input) {
    FastFourierTransformer transformer = new FastFourierTransformer(DftNormalization.STANDARD);
    Complex[] complexResults = transformer.transform(input, TransformType.FORWARD);

    for(Complex c:complexResults){
        System.out.println(c.getReal());
    }
    System.out.println(complexResults.toString());
}
}

And its usage:

public class main {

public static void main(String[] args) {
    double[] xValues = new double[]{0.5,1.5,1.2,0.5,0.8,1.5,1.9,2.9};

    MyFFT.computeFFT(xValues);
}
}

Output:

10.8
1.3970562748477138
-1.7999999999999998
-1.9970562748477145
-2.0
-1.9970562748477139
-1.7999999999999998
 1.3970562748477144
Zeeshan
  • 858
  • 4
  • 16
  • 30
Georgi Koemdzhiev
  • 11,421
  • 18
  • 62
  • 126
  • See [this SO question/answer](http://stackoverflow.com/a/4371627/253056) which explains how FFT bin outputs relate to frequency. – Paul R Jan 11 '17 at 09:55
  • 1
    FFT bins are exactly the same as DFT bins. The 'F' is just an implementation detail. The real part of a DFT bin is not very interesting. You probably want to look at magnitude instead. – Emanuel Landeholm Jan 11 '17 at 09:59
  • @EmanuelLandeholm hey, thank you for your reply. I will definitely check the output out the magnitude. – Georgi Koemdzhiev Jan 11 '17 at 10:39
  • For one thing, ignoring the imaginary component of the FFT results makes no sense at all. You probably want a power spectrum. I highly recommend you do some reading on the mathematics of FFT , power spectra, zero-padding data series, etc. There are assumptions involved in FFTs that can't be ignored when you interpret them. A little bit of knowledge about FFTs is a dangerous thing. – Gene Jan 16 '17 at 17:26

0 Answers0