Index-> contents reference index search Up-> SPT_HELP FourierFunctions fft Prev Next SPT_HELP-> SPTFunctionsByCategory Mathematical Functions Data Manipulation Functions SignalGeneratorMain AnalogFilterFunctions FIR Filter Design Window Functions IIR Filter Design FourierFunctions Plotting Functions Histogram Functions FourierFunctions-> fft ifft dft2d idft2d welch stft fft Headings-> Description Example

Fast Fourier Transform
 Syntax `y = fft(`x`)` Include: `include spt\fft.oms` See Also fft , ifft
``` ARGUMENTS:    INPUTS:       x = MATRIX/VECTOR, any numerical type    RETURN: MATRIX, COMPLEX ```
Description ``` ```Fast Fourier Transform. This is the typical FFT, listing the result in the standard order of non-negative frequency values first, followed by reversed negative frequency values. The function is identical to the O-Matrix "dft()" function. It has been provided here under the name "fft()" 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\fft.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 "ifft(x)" SPT function also produces matching standard FFT behavior. ``` ```Example
Do the FFT of a single cycle of a cosine waveform: ``` include spt\fft.oms N    = 8;              # FFT sample length t    = seq(N)-1d0;     # time vector x    = cos(2*PI*t/N);  # Signal to transform YFFT = fft(x);         # Do FFT format complex "f5.2"; YFFT ``` O-Matrix responds with: ``` { (-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) } ```