Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is correct result after FFT, if input array is {0,1,2,3,4,5,6,7}

Tags:

fft

can anyone tell me what is correct result after Fast Furier Transform, if input array is {0,1,2,3,4,5,6,7}.

I got {28,0,0,0,0,0,0,0}. It isn't correct right?

just want to test FFT implementation in C.

thanks, Andrey

like image 427
andrey Avatar asked May 30 '11 14:05

andrey


3 Answers

The correct answer to a FFT for {0,1,2,3,4,5,6,7} is

{28.0000 + 0.0000i, 
-4.0000 + 9.6569i,
-4.0000 + 4.0000i,
-4.0000 + 1.6569i,
-4.0000 + 0.0000i, 
-4.0000 - 1.6569i,
-4.0000 - 4.0000i,
-4.0000 - 9.6569i}
like image 80
Divij Avatar answered Sep 19 '22 05:09

Divij


No, it isn't correct (a single non-zero output element implies that your input consists of either a constant value, or a single complex-exponential component).

Why don't you use an existing FFT implementation, such as FFTW to provide a reference result? Or just implement a straightforward DFT?

like image 30
Oliver Charlesworth Avatar answered Sep 18 '22 05:09

Oliver Charlesworth


According to Wolfram Alpha it's:

enter image description here

Note that there is no single "correct answer" as there is more than one definition of the DFT/FFT, the difference between each one being what scaling factor you include for forward and inverse transform. (The difference between this answer and the earlier accepted answer is just a scaling factor of sqrt(8)).

like image 24
Paul R Avatar answered Sep 19 '22 05:09

Paul R