[ top | up ]

Discrete Fourier Transform

Syntax

fft(x, y=rep(0,length(x)), inverse=F)

Arguments

x,y vectors giving the real and imaginary parts of the sequence to be tranformed.
inverse if true, the inverse transform is computed (the inverse has a + in the exponent of e and divides the values by 1/length(x) before transforming).

Description

fft performs the fast version of the discrete Fourier transform. It returns a list containing components x, and y which give the real and imaginary parts of the transform. The transform is fastest when the length of x is highly composite (i.e. has many factors). If this is not the case, the transform may take a long time to compute and will use a large amount of memory.

References

Singleton, R. C. (1979). Mixed Radix Fast Fourier Transforms, in Programs for Digital Signal Processing, IEEE Digital Signal Processing Committee eds. IEEE Press.

See Also

convolve, nextn.

Examples

# compute the periodogram the long way x <- rnorm(1000) z <- fft(x) Ixx <- (z$x^2+z$y^2)/(2*pi*length(x))