dct(data, m = NULL, fit = FALSE)The algorithm first reflects the input signal about the last data point, N. Thus if the input signal vec if of length N, the algorithm creates a vector c(vec, rev(vec[-c(1,N)])). and the R fft function is applied to this reflected signal. The DCT coefficients are real part of what is returned by fft i.e. the amplitudes of the cosine waves of frequencies k = 0, 1, 2, ...2 *(N-1) radians per sample. The phase is zero in all cases. The amplitudes are calculated in such a way such that if these cosine waves are summed, the original (reflected) signal is reconstructed. What is returned by dct() are the amplitudes of the cosine waves (DCT coefficients) up to a frequency of N radians/sample, i.e. a vector of cosine wave amplitudes that has the same length as the original signal and of frequencies k = 0, 1, 2, ... (N-1). Alternatively, if fit=T, a smoothed signal of the same length as the original signal is obtained based on a summation of the lowest ordered DCT coefficients. This dct() algorithm returns very similar values to DCT() with inv=F written by Catherine Watson and used in Watson & Harrington (1999).
Zahorian, S., and Jagharghi, A. (1993). Spectral-shape features versus formants as acoustic correlates for vowels, Journal of the Acoustical Society of America, 94, 19661982.
plafit bydata(vowlax)
# obtain the first four DCT coefficients
# (frequencies k = 0, 1, 2, 3) for some
# first formant frequency data
vec <- vowlax.fdat[1,1]$data
dct(vec, m=4)
# obtain the corresponding smoothed
# trajectory
dct(vec, m=4 , fit=TRUE)Run the code above in your browser using DataLab