dftMatrix {mrbsizeR}R Documentation

Create a n-by-n discrete Fourier transform matrix.

Description

The discrete Fourier transform (DFT) matrix for a given dimension n is calculated.

Usage

dftMatrix(n)

Arguments

n

Dimension for the DFT matrix.

Details

The DFT matrix can be used for computing the discrete Fourier transform of a matrix or vector. dftMatrix(n) %*% testMatrix is the same as apply(testMatrix, MARGIN = 2, FUN = fft).

Value

The n-by-n DFT matrix.

Examples

set.seed(987)
testMatrix <- matrix(sample(1:10, size = 25, replace = TRUE), nrow = 5)
D <- dftMatrix(5)

# Discrete Fourier transform with matrix multiplication:
D %*% testMatrix 

# Discrete Fourier transform with function fft: 
apply(testMatrix, MARGIN = 2, FUN = fft)


[Package mrbsizeR version 1.3 Index]