Prev Next ifft

Inverse Fast Fourier Transform
Syntax y = ifft(x)
Include: include spt\ifft.oms
See Also fft , ifft

ARGUMENTS:
   INPUTS:
      x = MATRIX/VECTOR, any numerical type
   RETURN: MATRIX, COMPLEX

Description

Inverse Fast Fourier Transform. This is the typical IFFT, listing the result in the standard order starting at time zero and increasing. The function is identical to the O-Matrix "idft()" function. It has been provided here under the name "ifft()" in order to make O-Matrix code more portable to other application and vice versa. When this function is loaded into the workspace with the command:

include spt\ifft.oms

it replaces the native version of the O-Matrix "fft()" function which is a "centered" version of the FFT. Clearing the workspace deletes this inclusion and so it must be included again to allow subsequent use. The matching "fft(x)" SPT function also produces matching standard FFT behavior.

Example
Use the SPT ifft() function to transform the FFT of a time waveform back into the original time waveform.

include spt\fft.oms
include spt\ifft.oms

format double  "f5.2";
format complex "f5.2";
N     = 8;             # Sample length
n     = seq(N)-1d0;    # Time vector
x     = cos(2*PI*n/N); # 1 cycle cosine wave
x

O-Matrix responds:

{
 1.00
 0.71
 0.00
-0.71
-1.00
-0.71
-0.00
 0.71
}

Do the FFT:

YFFT  = fft(x);        # Do the SPT FFT
YFFT

O-Matrix gives:

{
(-0.00, 0.00)
( 4.00,-0.00)
( 0.00, 0.00)
(-0.00,-0.00)
( 0.00, 0.00)
(-0.00, 0.00)
( 0.00, 0.00)
( 4.00, 0.00)
}

Finally, do the inverse FFT:

YIFFT = ifft(YFFT);    # Do the IFFT
YIFFT

And, O-Matrix yields:

{
( 1.00, 0.00)
( 0.71, 0.00)
(-0.00, 0.00)
(-0.71, 0.00)
(-1.00, 0.00)
(-0.71, 0.00)
(-0.00, 0.00)
( 0.71, 0.00)
}