Frequency with fft.complexForward | Shouland
Outputs of FFT are complex numbers. The method complex forward calculates the FFT of the fftData and puts it back in fftData. The even indices are real parts of the FFT while the odd indices are the imaginary parts. Since this code is calculating the magnitudes in the end, there’s no need for a for loop. So instead of,
for (int i=0;i<mNumberOfFFTPoints;i++){
fftData[2 * i] = signal[i];
fftData[2 * i + 1] = 0;
fft.complexForward(fftData);
}
Just write :
fft.complexForward(fftData);
Read more here: Source link