DCTRANS

From STX Wiki
Jump to navigationJump to search

DCTRANS - discrete cosine transform

Usage:

DCTRANS x dir n

Inputs:
x input vector
dir direction: 'Forward' or 'Inverse'
n the number of coefficients
Outputs:
y vector containing result of transformation
Function:

Discrete Cosine Transform (DCT) - forward and inverse. The DCT is defined as follows:

3190.png for 3191.png, 3192.pngfor 3193.png

The forward DCT is defined by the formula:

3194.png

If dir is Forward:

if 0 < n < len(x) only the first n coefficients are stored in the output
otherwise len(x) coefficients are stored in the output

The definition of the inverse discrete cosine transform is:

3195.png

If dir = Inverse:

if 0 < n < len(x) only the first n coefficients of x are used for the
inverse transformation (the others are set to 0);
transformation and output length = len(x)
if n > len(x) vector x is expanded with zeros to length n
transformation and output length = n
otherwise transformation and output length = len(x)

Navigation menu

Personal tools