From: Adam Shelly Date: 2006-06-03T04:47:33+09:00 Subject: Re: Time domain to frequency domain with FFT from GSL On 6/2/06, Alex Polite wrote: > OK, so say I'm using the ruby wrapper round FFTW3. > > na is my time domain data. Then I can get my freq domain data by this: > > FFTW3.fft(na, -1).real[0..na.length/2-1] > > Right? > What do you want to do with the result? FFTW3.fft(na, -1) gives you an array of complex numbers. You probably can't just throw away the imaginary part. For example, I just used FFTW in a C application to plot the spectrum of a signal. I plotted something equivalent to n = na.length fd = FFTW3.fft(na, -1) plotdata = fd.real.zip(fd.imag).map {|re, im| r = re/n; i = im/n; Math::sqrt(r*r + i*i) } I'm lucky enough to have a math genius in the office to consult for these things. The book Dido recommended may be your next best bet...