GREG NEELEY on 4 Jul 2007 02:38:41 -0000

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PhillyOnRails] FFTs using Ruby...

July 3, 2007

A short note on performing Fast Fourier Transforms (a linchpin of digital signal processing) using Ruby follows.

In 1984, I wrote some FORTRAN software implementing Ken Water's 1-D seismogram
algorhythm from his classic textbook, "Reflection Seisomology".

I got a letter from Dr. Waters at that time from South Africa concerning a question I had on
some reflection coefficients, but, needless to say, his method worked beautifully on a Data General
machine running the SPEX (Seismic Processing Executive) on some data we had acquired in Central Kansas.

To the point, I was curious to see what if any progress had been made in the FFT (Fast Fourier Transform)
area since I implemented an inverse FFT in Dr. Water's method in the software I wrote.

Progress has, in fact, been made. Check out this URL...

Takesi Horinouchi has posted a beautiful example of using forward and reverse FFTs using Ruby.

It does require that you build some C software you can download, but he gives the linke to get that done.

(There's a typo in his installation want the ruby-fftw3, not simply the fftw3.  That should already be installed.)

Takesi also points out you need some software to handle special arrays, but he also gives the link to get that
done at the above URL. It's the "FFTW"  (Fastest Fourier Transform in the West), developed by some men of MIT.  I loved their response when asked, "I thought MIT was in the East": "Not if you're Italian!", quipped the co-author:-)

I entered Takesi's small Ruby application shown at his URL using irb,  performing both forward and inverse FFTs on a unit impulse (single "spike" at array position 1,1)and, as he clearly states in his short note at the URL, "the inverse FFT returns the spike, with the exception of round-off error" ( or words to that effect).

I used the Suse LINUX gcc compiler and Ruby 1.8.4.

If you can get hold of Brigham's book on FFTs, you'll find this to be a completely fascinating and highly useful area of mathematics on your home computer.

Hope this helps, fellow Rubyists, Rubites, or "People who like Ruby", or whatever else we're called;-)

-Greg in KC.
To unsubscribe or change your settings, visit: