FourierDCT

FourierDCT[list]

finds the Fourier discrete cosine transform of a list of real numbers.

FourierDCT[list,m]

finds the Fourier discrete cosine transform of type m.

Details

  • Possible types m of discrete cosine transform for a list of length giving a result are:
  • 1.DCT-I
    2.DCT-II
    3.DCT-III
    4.DCT-IV
  • FourierDCT[list] is equivalent to FourierDCT[list,2].
  • The inverse discrete cosine transforms for types 1, 2, 3, and 4 are types 1, 3, 2, and 4, respectively.
  • The list given in FourierDCT[list] can be nested to represent an array of data in any number of dimensions.
  • The array of data must be rectangular.
  • If the elements of list are exact numbers, FourierDCT begins by applying N to them.
  • FourierDCT can be used on SparseArray objects.

Examples

open allclose all

Basic Examples  (2)

Find a discrete cosine transform:

Find the inverse discrete cosine transform:

Find a discrete cosine transform of type 1 (DCT-I):

Find the inverse discrete cosine transform:

Scope  (2)

Use machine arithmetic to compute the discrete cosine transform:

Use 24-digit precision arithmetic:

A two-dimensional discrete cosine transform:

A five-dimensional discrete cosine transform:

Generalizations & Extensions  (2)

The list may have complex values:

You can use "I", "II", "III", or "IV" for the types 1, 2, 3, and 4, respectively:

Applications  (3)

Compressing Image Data  (1)

Import some image data:

The two-dimensional DCT:

The diagonal spectra shows exponential decay:

Truncate modes in each axis, effectively compressing by a factor of :

Invert the DCT:

Cosine Series Expansion  (1)

Get an expansion for an even function as a sum of cosines:

The function values on a uniformly spaced grid with points on :

Compute the DCT-III and renormalize:

The function has, in effect, been periodized with a particular symmetry:

Plot the expansion error where the points are defined:

Chebyshev Basis Expansion  (1)

Get an expansion for a function in the Chebyshev polynomials:

The values of the function at the Chebyshev nodes:

Find the Chebyshev coefficients:

Show the error:

Properties & Relations  (3)

DCT-I and DCT-IV are their own inverses:

DCT-II and DCT-III are inverses of each other:

The DCT is equivalent to matrix multiplication:

Possible Issues  (1)

FourierDCT always returns normalized results:

To get unnormalized results, you can multiply by the normalization:

Introduced in 2007
 (6.0)