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:
The forward DCT is defined by the formula:
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:
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) |