DSPRelated.com
Forums

FFTW Accuracy vs Matlab Accuracy

Started by Clyde April 12, 2007
Clyde wrote:

> pgw wrote: > >> How it look without windowing? > > They are different, and the problem still remains. > >> You can try to generate one harmonic signal and do FFTW (without windowing) >> on it and then show us the result. > > Here is the result: > http://i45.photobucket.com/albums/f77/yesitookmypills/FFT.png > (blue is FFTW, red is Matlab FFT) > > I used fftw_plan_r2r_1d(dim, in[0], out[0], FFTW_R2HC, FFTW_ESTIMATE) > and i compute the magnitude in this way: > magnitude[i] = sqrt(out[i]*out[i]);
I used FFTW only one time, so I'm not familiar with it. Try use fftw_plan_dft_r2c_1d and then compute magnitude as: sqrt(real_of_outpute^2 + imaginary_of_outpute^2). That will have to work. -- pgw
Scott Seidman :

>> Don't you need to deal with the "half complex" format that fftw is >> asked to produce before you deal with the magnitude?
Yes, you are right. I missed that in half complex format complex is in reversed order, starting from the end -2 (!) Now it seem to work! I'll do some more analysis with windows. Thanks _A LOT_ you all -- Clyde
pgw wrote:

> I used FFTW only one time, so I'm not familiar with it. > Try use fftw_plan_dft_r2c_1d and then compute magnitude as: > sqrt(real_of_outpute^2 + imaginary_of_outpute^2). That will have to work.
I tried that, but i think there's something about the complex order that i wasn't getting. I have to admint that with r2c_1d also real numbers were different from matlab.. -- Clyde