Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.4K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Issues while attempting to implement my own version of FFT

Posted 2 years ago

Hey everyone. As the title suggests, I am attempting to implement a manual version of the Cooley-Tukey Fast Fourier Algorithm in Mathematica but I cannot get it to work. Below is the code that I have written:

FFT[list_] := If[Length[list] <= 2, Fourier[list],
  N2 := Length[list];
  Wn := E^(2 \[Pi] I/N2);
  W := 1;
  Aeven := list[[2 ;; ;; 2]];
  Aodd := list[[1 ;; ;; 2]];
  Yeven := FFT[Aeven];
  Yodd := FFT[Aodd];
  For[j = 0, j < N/2, j++,
   Y[j] := Yeven[j] + W*Yodd[j];
   Y[j + N/2] := Yeven[j] - W*Yodd[j];
   W := W*Wn];]]

I am unsure how to get the last For-loop to save the values in the new list Y, and how to then return it so that it can be accessed later. For reference, this is some pseudocode of what I am trying to do: enter image description here

Any help and/or comments would be greatly appreciated!

POSTED BY: Koen Denekamp
2 Replies
Posted 2 years ago
POSTED BY: Eric Rimbey
Posted 2 years ago

Thank you so much! I figured out that the reason why it gives different answers, is that the algorithm does not normalize, while the default Fourier[] command does do some normalization, so adding the "FourierParameters -> {1,1}" option, which removes the normalization, does give the same values (Up to some numerical differences).

POSTED BY: Koen Denekamp
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard