fftw/c++ computes fft wrong, compared to matlab
I am trying fftw with c++. I want to test that it works correct. I implemented a simple ifft(fft(shift(data)) - data == 0 test, that fails completely. The testdata is a rect function, with amplitude and phase 1. The matlab code for comparison works perfectly with the same test. The basic question is: what am I doing wrong? Here the matlab code (which is also using fftw...) FFTW dll/.h is latest. data = zeros(1, 64); halfsize = numel(data)/2; data(halfsize-10:halfsize+10) = 1; phase = ones(size(data)); data = data.*exp(phase*sqrt(-1)); Ft = fft(fftshift(data)); In C++ the code is (not complete)