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

Description Usage Arguments Details Value Examples

View source: R/DFT_matrix.R

Description

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

Usage

1

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

1
2
3
4
5
6
7
8
9
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)

romanflury/mrbsizeR documentation built on Dec. 15, 2019, 9:30 p.m.