Main Content

Modified discrete cosine transform

sets each property `Y`

= mdct(`X`

,`win`

,`Name,Value`

)`Name`

to the specified `Value`

.
Unspecified properties have default values.

The modified discrete cosine transform is a time-frequency transform. Given an input
signal `X`

and window `win`

, the
`mdct`

function performs the following steps for each independent channel:

The frame size is the number of elements in the specified window,

*N*=`numel(`

. By default,`win`

)`PadInput`

is set to`true`

, so the input signal`X`

is padded with*N*/2 zeros on the front and back. If the input signal is not divisible by*N*, additional padding is added on the back. After padding, the input signal is buffered into 50% overlapped frames.Each frame of the buffered and padded input signal is multiplied by the window,

`win`

.The input is converted into a frequency representation using the modified discrete cosine transform:

$$Y(k)={\displaystyle \sum _{n=0}^{N-1}X\left(n\right)\mathrm{cos}\left[\frac{\pi}{\left(\raisebox{1ex}{$N$}\!\left/ \!\raisebox{-1ex}{$2$}\right.\right)}\left(n+\frac{\left(\raisebox{1ex}{$N$}\!\left/ \!\raisebox{-1ex}{$2$}\right.\right)+1}{2}\right)\left(k+\frac{1}{2}\right)\right]}\text{\hspace{0.17em}},\text{\hspace{1em}}k=0,1,\mathrm{...},\left(\raisebox{1ex}{$N$}\!\left/ \!\raisebox{-1ex}{$2$}\right.\right)-1$$

To take advantage of the FFT algorithm, the MDCT is calculated by first calculating the odd DFT:

$${Y}_{\text{O}}(k)={\displaystyle \sum _{n=0}^{N-1}X\left(n\right){e}^{-j\frac{\pi n}{N}\left(2k+1\right)}}\text{\hspace{0.17em}},\text{\hspace{1em}}k=0,1,\mathrm{...},N-1$$

and then calculating the MDCT:

$$Y(k)=\Re e\{{Y}_{\text{o}}(k)\}\mathrm{cos}\left(\frac{\pi}{N}\left(k+\frac{1}{2}\right)\left(1+\frac{N}{2}\right)\right)\text{\hspace{0.17em}},\text{\hspace{1em}}k=0,1,\mathrm{...},\left(\raisebox{1ex}{$N$}\!\left/ \!\raisebox{-1ex}{$2$}\right.\right)-1$$

If a second argument is requested from the `mdct`

function, the modified discrete sine transform (MDST) is also computed and returned:

$$X(k)=\Im m\{{X}_{\text{o}}(k)\}\mathrm{sin}\left(\frac{\pi}{N}\left(k+\frac{1}{2}\right)\left(1+\frac{N}{2}\right)\right)\text{\hspace{0.17em}},\text{\hspace{1em}}k=0,1,\mathrm{...},\left(\raisebox{1ex}{$N$}\!\left/ \!\raisebox{-1ex}{$2$}\right.\right)-1$$

[1] Princen, J., A. Johnson, and A.
Bradley. "Subband/Transform Coding Using Filter Bank Designs Based on Time Domain Aliasing
Cancellation." *IEEE International Conference on Acoustics, Speech, and Signal
Processing (ICASSP)*. 1987, pp. 2161–2164.

[2] Princen, J., and A. Bradley.
"Analysis/Synthesis Filter Bank Design Based on Time Domain Aliasing Cancellation."
*IEEE Transactions on Acoustics, Speech, and Signal Processing.* Vol.
34, Issue 5, 1986, pp. 1153–1161.