Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FFT interpretation

I am wokring on an Android project where I am using FFT for processing accelerometer data and I have problems understanding how are these things actually working. I am using jTransform library by Piotr Wendykier in the following way:

        int length = vectors.length;
        float[] input = new float[length*2];
        for(int i=0;i<length;i++){
            input[i]=vectors[i];
        }

        FloatFFT_1D fftlib = new FloatFFT_1D(length);
        fftlib.complexForward(input);

        float outputData[] = new float[(input.length+1)/2];
        if(input.length%2==0){
            for(int i = 0; i < length/2; i++){

                outputData[i]= (float) Math.sqrt((Math.pow(input[2*i],2))+(Math.pow(input[2*(i)+1], 2)));
            }
        }else{
            for(int i = 0; i < length/2+1; i++){

                outputData[i]= (float) Math.sqrt((Math.pow(input[2*i],2))+(Math.pow(input[2*i+1], 2)));
            }
        }

        List<Float> output = new ArrayList<Float>();
        for (float f : outputData) {
            output.add(f);
        }

the result is an array with following data output data visualization.

I have problem with interpreting the output data..The data are from 10 seconds long interval, and the sampling frequency is 50Hz..While capturing I was moving the phone up and down cca each 3/4 second in my hand, so is possible that the extreme which is about x value 16 could be the period of the strongest component of the signal? I need to obtain the frequency of the strongest component in the signal..

like image 892
simekadam Avatar asked Jan 06 '12 21:01

simekadam


People also ask

What does the FFT tell you?

The output of the FFT is a complex vector containing information about the frequency content of the signal. The magnitude tells you the strength of the frequency components relative to other components. The phase tells you how all the frequency components align in time.

How do you read FFT frequency?

Example: fs = 8000 samples per second, N = 16000 samples. Therefore, x lasts two seconds long. Suppose X = fft(x) has peaks at 2000 and 14000 (=16000-2000). Therefore, f0 = 8000*2000/16000 = 1000 Hz.

What does an FFT spectrum show?

FFTs and the Power Spectrum are useful for measuring the frequency content of stationary or transient signals. FFTs produce the average frequency content of a signal over the entire time that the signal was acquired.


1 Answers

The frequency represented by each fft result bin is the bin number times the sample rate divided by the length of the fft (convolved with a Sinc function giving it non-zero width, to get a bit technical). If your sample rate is 50 Hz and your fft's lenght is fft length is 512, then bin 16 of the fft result would represent about 1.6 Hz which is close to having a period of 0.7 seconds.

The spike at bin 0 (DC) might represent the non-zero force of gravity on the accelerometer.

like image 91
hotpaw2 Avatar answered Oct 12 '22 09:10

hotpaw2