dftmtx: Discrete Fourier Transform Matrix

View source: R/dftmtx.R

dftmtxR Documentation

Discrete Fourier Transform Matrix

Description

Compute the discrete Fourier transform matrix

Usage

dftmtx(n)

Arguments

n

Size of Fourier transformation matrix, specified as a positive integer.

Details

A discrete Fourier transform matrix is a complex matrix whose matrix product with a vector computes the discrete Fourier transform of the vector. dftmtx takes the FFT of the identity matrix to generate the transform matrix. For a column vector x, y <- dftmtx(n) * x is the same as y <- fft(x, postpad(x, n). The inverse discrete Fourier transform matrix is inv <- Conj(dftmtx(n)) / n.

In general this is less efficient than calling the fft and ifft functions directly.

Value

Fourier transform matrix.

Author(s)

David Bateman, adb014@gmail.com.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.

See Also

fft, ifft

Examples

x <- seq_len(256)
y1 <- stats::fft(x)
n <- length(x)
y2 <- drop(x %*% dftmtx(n))
mx <- max(abs(y1 - y2))


gsignal documentation built on Sept. 12, 2024, 6:27 a.m.