MatLab Solutions: "Introduction to Digital Signal Processing: A Computer Laboratory Textbook".
29 Oct 2012
25 Nov 2013)
These files are the MatLab solutions of exercises contained in the above DSP lab textbook.
function x = my_Re_IDCT(X)
% Discrete Cosine Transform Computation.
% This function computes the inverse DCT of a real input signal X[k]
% stored in vector X by use of it's relationship with the DFT.
% Attention: Length of X should be even.
% First convert input vector X to a row vector for subsequent processing:
X = X(:).';
N = length(X);
X = [sqrt(N)*X(1) sqrt(2*N)*X(2:end)];
% Create the phasor:
k = 0:N-1;
phasor = exp(1i*pi*k/(2*N));
% Multiply the first N elements of Y with the complex phasor.
X1 = real(ifft(phasor.*X));
x = zeros(1,N);
% De-interleave the results:
x(2*n-1) = X1(n);
x(2*n) = X1(N+1-n);