2d and 3d Fourier transforms


Recently, I’ve been playing with multidimensional Fourier transforms, which is something that I’ve meant to do for awhile but finally got around to during a mini-hackathon I participated in with Fred Manby and his group members. The left hand panel above shows the function z(x,y) = cos(0.5πx + 1.5πy) + cos(1.5πx + 0.5πy); the right hand panel shows the 2d discrete FFT of z(x,y). The two peaks visible in the Fourier plot correspond to the wave vectors of each of the cosine functions ([0.5, 1.5] and [1.5, 0.5]). Using the 1d FFT routine in alglib, I wrote some C++ source code and tests to generate the plots shown above; the files testFunctions.h and testFunctions.cpp include routines for both two and three-dimensional Fourier transforms. I haven’t yet worked on optimizing this code, but it’s simple, reasonably fast, and all my tests show that it gives the correct answers!

and here’s another one, just for fun…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s