Calculates the unitary Discrete Cosine Transform.
DCT(series, n)
series |
- |
An input series or array. |
n |
- |
Optional. An integer, the transform length. Defaults to |
A series or array.
dct(gcos(100, 1/100, 20))
returns a series with a peak at 20 Hz.
dct(gcos(100, 1/100, 20), 1024)
Same as above, but the input is zero padded to length 1024 before the DCT is calculated.
The unitary discrete cosine transform is define as:
The DCT returns a real result for a real input series.
The transform is applied to each column if the input is an array.
Because relatively few DCT terms can be used to account for a large percentage of series energy, the DCT is often used in signal and image processing applications to perform data compression.