dct

Discrete cosine transform.

Syntax

y = dct(x)

y = dct(x,n)

Inputs

x
The signal to be transformed.
Type: double
Dimension: vector | matrix
n
The dct length (default: the signal vector length).
Type: integer
Dimension: scalar

Outputs

y
The transform of x.

Example

x = [1, 4, 9, 16, 25, 36, 49, 64];
y = dct(x)
y = [Matrix] 1 x 8
72.12489  -57.98091  12.61729  -6.06109  2.82843  -1.80813  0.89668  -0.45632

Comments

The dct is applied to a vector input or to each column vector of a matrix input. When n is used, each input vector is either truncated or extended with zeroes to the specified length. dct uses the FFTW library.