Next: fftb, Previous: fcwrite, Up: Internal Routines [Contents][Index]
fft(data [, axes, /allaxes, /amplitudes])
fft, data [, axes, /allaxes, /amplitudes]
Returns a discrete forward Fourier transform of the real
data
along the indicated axes
. By default,
the forward transform (to frequency space) is applied in the first
dimension. The returned values are of type double
. The
subroutine form replaces data
with the transformed
version.
If axes
is specified, then it is taken to contain the
axes along which transformation is to be done. No axis may appear
more than once. The axes need not be in any specific order. If
/allaxes
is specified, then all axes are treated. If neither
axes
nor /allaxes
are specified, then the first
axis is assumed. The data may have arbitrary positive dimensions.
The returned array has the same dimensions as data
.
The result are stored as ’half-complex’ sequences, in order of
increasing frequency. For each frequency, first the real and then the
imaginary part is given, except that no imaginary part is given for
values that are always real, i.e., for frequency zero and (for
even-length sequences) also for the highest represented frequency
(equal to half of the sequence length). The Fourier transform (of
real data) at a negative frequency is the complex conjugate of the
Fourier transform at the corresponding positive frequency, and the
Fourier transform at frequency f
is equal to that at
frequency f mod n
for sequence length
n
.
Note that only one half of the relevant frequencies are represented in
the results, because the missing half can be constructed from the
provided half by complex conjugation. Just adding up the squares of
all of the values in the result and dividing by the sequence length
does not give you the sum of squares of x
; you have to
add in the missing part, too. And remember that frequency zero counts
only once, and [for even-length sequences] the highest represented
frequency counts only once, too.
The returned values are such that if x
contains a pure sine or
cosine wave, then the magnitude of the value in the appropriate
element of the result is equal to the amplitude of the wave times
n
(for the very first element, and – if n
is even – also the very last element) or n/2
.
If /amplitudes
is specified, then the returned values are
scaled such that their magitude is equal to the magnitude of the
corresponding wave.
The calculation speed of the algorithm depends strongly on the number of data points in the dimension in which the algorithm is applied. For quickest results, that number of data points should only have factors equal to small prime numbers, such as 2, 3, and 5.
Opposite: fftb
[2.12.322, 4.0]
Next: fftb, Previous: fcwrite, Up: Internal Routines [Contents][Index]