# DCT

## Purpose:

Calculates the unitary Discrete Cosine Transform.

## Syntax:

DCT(series, n)

series |
- |
An input series or array. |

n |
- |
Optional. An integer, the transform length.
Defaults to **length(series)**. |

## Returns:

A series or array.

## Example:

dct(gcos(100, 1/100, 20))

returns a series with a peak at 20 Hz.

## Example:

dct(gcos(100, 1/100, 20), 1024)

Same as above, but the input is zero padded to length 1024 before the
DCT is calculated.

## Remarks:

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.

## See Also:

DCT2

DST

IDCT

IDCT2

FFT