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

along the indicated `data`

. By default,
the forward transform (to frequency space) is applied in the first
dimension. The returned values are of type `axes``double`

. The
subroutine form replaces

with the transformed
version.
`data`

If

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
`axes``/allaxes`

is specified, then all axes are treated. If neither

nor `axes``/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

is equal to that at
frequency `f`

for sequence length
`f` mod `n`

.
`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

; 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.
`x`

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

(for the very first element, and – if `n`

is even – also the very last element) or `n`

.
`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]