I'm transforming one period of a sawtooth signal: -1, -0.998, -0.996, -0.994, ..., +0.994, +0.996, +0.998. The fftw plan I use is: fftw_plan_dft_r2c_1d(N, in, out, FFTW_ESTIMATE); This is the result that I expect: -0.636sin(x) -0.318sin(2x) -0.212sin(3x) -0.159sin(4x) -0.127sin(5x)... And this is what I get: +0.636sin(x) +0.318sin(2x) +0.212sin(3x) +0.159sin(4x) +0.127sin(5x)... As you can see, the absolute values are correct, but signs are not and th= e reconstructed signal is mirrored vertically. Why is that? Am I overlookin= g something? TIA Vedran Fura=C4=8D
Problem using fftw
Started by ●September 7, 2007
Reply by ●September 7, 20072007-09-07
Pure speculation, but it could be a misinterpretation of the result: In the frequency domain, a real-valued "1" in the first bin means a cosine wave of the fundamental frequency (in combination with a real-valued "1" in the last bin). So far so good. But 1i in combination with -1i in the last bin is MINUS sine. Mixing this up exchanges positive and negative frequencies => reverse the time axis. -mn
Reply by ●September 7, 20072007-09-07
>> a real-valued "1" in the first binBrain damage by prolonged exposure to C... The _first_ bin is DC. Example for cos: 0 1 0 0 0 0 0 1 Cheers Markus
Reply by ●September 10, 20072007-09-10
I forgot to post this earlier, an example using FFTW in C: http://www.elisanet.fi/mnentwig/webroot/FFTW_example/index.html Cheers Markus