[Top][All Lists]

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

fft: Octave vs. Matlab vs. IDL

From: E. Joshua Rigler
Subject: fft: Octave vs. Matlab vs. IDL
Date: Thu, 27 Sep 2001 15:27:56 -0600

I've taken the FFT of a sine function defined by:

 >> t = [0:(2*pi)/288:50*2*pi - (2*pi)/288]';
 >> sint = sin (t);
 >> f = real(fft(sint));

in MATLAB, Octave, and IDL.  All three give me different answers,
although they do give a peak in power at 50, as expected.

  Matlab -> peak at 50 of ~  2e-11
  Octave -> peak at 50 of ~ -8e-11 (yes that "-" is real)
  IDL    -> peak at 50 of ~  2e-06 (PI here was single precision)

I am trying to use the FFT to calculate an auto-correlation.  I know
this sounds strange, but the very slight differences I get between
calculating auto-correlations this way, and by using something like
xcov.m, significantly affects the stability, and predictive accuracy of
the linear prediction filters I am trying to least when
testing it on a simple sine function.  As much as I hate to say it, I
suspect that the FFT from IDL is giving the most reasonable answer,
because it spits out a relatively smooth function, with only a single
peak at 50, whereas both Octave and Matlab spit out very noisy data,
with local peaks almost as large as the main one at 50!

Can somebody who knows more about FFTs than me suggest a reason why
these would all return different values (and more importantly, how might
I get them to return more similar answers)?  I might guess this has
something to do with padding my vectors with zeros in a certain way, but
that is only because I've heard people say this...I don't really
understand what that means, or how it affects the FFT algorithm.


Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]