FFT and IFT Instructions |
FFT cseries start end newcseries newcstart
IFT cseries start end newcseries newcstart
FFT does a Finite Fourier transform and IFT does an inverse Fourier transform. RATS uses a Fast Fourier transform algorithm which can transform series of any length, although it is much faster for lengths which are products of powers of two, three and five.
Note that real-valued data series need to be moved to the frequency domain before you can apply FFT—see RTOC.
Parameters
|
cseries |
source series |
|
start, end |
range to transform, by default range of cseries |
|
newcseries |
result series, by default, overwrite cseries |
|
newstart |
start for newcseries, by default start |
Description
The Finite Fourier transform of the series \(X\left( t \right),t = 1, \ldots ,T\) can be written
\(\tilde X\left( {2{\kern 1pt} \pi {\kern 1pt} j/T} \right) = \sum\limits_{t = 1}^T {X\left( t \right)\exp \left( { - 2\pi {\kern 1pt} {\kern 1pt} i{\kern 1pt} j\left( {t - 1} \right)/T} \right)} ;j = 0,{\kern 1pt} {\kern 1pt} {\kern 1pt} 1,{\kern 1pt} {\kern 1pt} {\kern 1pt} \ldots ,{\kern 1pt} {\kern 1pt} {\kern 1pt} T - 1\)
The frequencies computed run from 0 to \(2\pi(T-1)/T\) by increments of \(2\pi/T\). Frequency 0 goes into entry newstart.
Usage
You will rarely need to use any parameters other than cseries and newcseries. The most common forms of the instructions are
fft cseries
fft cseries / newcseries
the first transforming cseries onto itself, the second transforming it to a new series.
Examples
The following passes series X through a high-pass filter, zeroing out a band around 0 frequency. The frequencies which aren’t zeroed are from \(\pi / 2\) (1/4 of the number of ordinates) to \(3\pi / 2\).
freq 2 256
rtoc
# x
# 1
fft 1
cset 1 = %z(t,1)*(t>64.and.t<=192)
ift 1
This next example computes a covariogram by inverse transforming the periodogram of a series. To get covariances computed correctly, the number of ordinates has to be at least double the number of data points, which is why the %FREQSIZE recommendation is doubled.
compute nords = %freqsize(2017:12)*2
freq 1 nords
rtoc
# employ
# 1
fft 1
cmult(scale=1.0/2017:12) 1 1
ift 1
Copyright © 2025 Thomas A. Doan