Function File: dct (x)
Function File: dct (x, n)

Compute the discrete cosine transform of x. If n is given, then x is padded or trimmed to length n before computing the transform. If x is a matrix, compute the transform along the columns of the the matrix. The transform is faster if x is real-valued and has even length.

The discrete cosine transform x can be defined as follows:

              N-1
  X[k] = w(k) sum x[n] cos (pi (2n+1) k / 2N ),  k = 0, ..., N-1
              n=0

with w(0) = sqrt(1/N) and w(k) = sqrt(2/N), k = 1, ..., N-1. There are other definitions with different scaling of X[k], but this form is common in image processing.

See also: idct, dct2, idct2, dctmtx.

Package: signal