I use this FFT and wrote a short program to test it.
package test_FFT;
import org.apache.commons.math3.transform.FastFourierTransformer;
import org.apache.commons.math3.transform.DftNormalization;
import org.apache.commons.math3.transform.TransformType;
public class FFT2 {
public static void main(String[] args) {
double[][] array=new double[2][8];
//An array of complex numbers with real part array[0][*]
//and complex part array[1][*]
//The output of the transformation will be saved in the input array
array[0][0]=5.0;
array[0][1]=2.0;
array[0][2]=3.0;
array[0][3]=4.0;
array[0][4]=5.0;
array[0][5]=6.0;
array[0][6]=7.0;
array[0][7]=9.0;
FastFourierTransformer.transformInPlace(array,DftNormalization.STANDARD,TransformType.FORWARD);
for(int i=0;i<8;i++){
System.out.println("real "+array[0][i]);
System.out.println("complex "+array[1][i]);
}
}
}
In the output array I get amplitudes of sin and cos functions. The information about the frequencies should depend on the position within the output array. After some research on this page, I still don't understand how to calculate frequencies out of array positions.
I learned that there are many flavours of how to perform a FFT. Has anyone of you detailed knowledge on how calculate frequencies out of output of the FFT I use? A code sample computing frequencies for the output of the example below would be greatly appreciated. Thank you