FFTW gives incorrect results compared to MATLAB
After analyzing some signal data, I do some resynthesis. For parsing, for example, a wav file, I am using CUDA-CUFFT to convert a 1D-complex-FFT after some signal processing operations (cutting pieces of signals, ...) I am performing an IFFT conversion using FFTWF (FFTW = for float type).
On the CUDA side, I have tested the FFT transform with MATLAB and I get almost the same results (due to rounding errors, it is not accurate). After cutting the signal and performing the FFTShift operation, the signals appear to be almost equal.
But after the IFFT operation I get different results (right after the IFFT operation I reverse the output I also do in MATLAB -> and finally I save the FFTW output in binary for comparison)
PS: (for more information, after flipping the output, I rate the results with sqrtf(FFTLEN);
(on the CUDA site rate, I output with1/sqrtf(FFTLEN)
For IFFT conversion with FFTW, I use the following syntax in the documentation:
http://www.fftw.org/doc/Complex-One_002dDimensional-DFTs.html
But instead of using fftw_complex type I use C ++ complex type and pass it to type fftw_complex. The FFTW_BACKWARD
beacuse token I use CUFFT_FORAWRD
on the CUDA site:
fftwf_plan localFFTPlan;
localFFTPlan = fftwf_plan_dft_1d((int)sFFTParams.uFFTLength, reinterpret_cast<fftwf_complex*>(&tFFTraw[0]), reinterpret_cast<fftwf_complex*>(&tFFTin[0]), FFTW_BACKWARD, FFTW_MEASURE);
fftwf_execute(localFFTPlan);
fftwf_destroy_plan(localFFTPlan);
MATLAB performs the same operation:
flipud(ifft(fftshift(st))
Can anyone help me why the results are wrong in the directive after the IFFT transformation (as shown above, everything is fine before the operation)?
CHANGE the array distribution looks like this: TFFTC container tFFTin (sFFTParams.uFFTLength, gComplexZero);
source to share
No one has answered this question yet
See similar questions:
or similar: