Engee documentation

dftmtx

The matrix of the discrete Fourier transform.

Library

EngeeDSP

Syntax

Function call

  • a = dftmtx(n) — returns a complex discrete Fourier transform matrix of size n on n.

Arguments

Input arguments

# n is the length of the discrete Fourier transform
positive integer scalar

Details

The length of the discrete Fourier transform, given as a positive integer scalar.

Типы данных

Float32, Float64

Output arguments

# a is the matrix of the discrete Fourier transform
the matrix

Details

The matrix of the discrete Fourier transform.

Examples

The FFT and DFT matrix

Details

In practice, the calculation of the discrete Fourier transform using the FFT is more efficient than using the DFT matrix. The FFT also uses less memory. Both procedures give the same result.

import EngeeDSP.Functions: dftmtx
import EngeeDSP.Functions: fft
import EngeeDSP.Functions: norm

x = collect(1:256)
y1 = fft(x)
n = length(x)
y2 = dftmtx(n) * x

norm(y1 - y2)
6.61575911216404e-12

Additional information

The matrix of the discrete Fourier transform.

Details

A discrete Fourier transform matrix is a complex matrix whose product by a vector computes the discrete Fourier transform of that vector. Function dftmtx uses the FFT of the identity matrix to generate the transformation matrix.

For a column vector x:

y = dftmtx(n)*x

the same as y = fft(x,n). The matrix of the inverse discrete Fourier transform:

ainv = conj(dftmtx(n))/n