Code covered by the BSD License  

Highlights from
MatLab Solutions: "Introduction to Digital Signal Processing: A Computer Laboratory Textbook".

image thumbnail

MatLab Solutions: "Introduction to Digital Signal Processing: A Computer Laboratory Textbook".

by

 

29 Oct 2012 (Updated )

These files are the MatLab solutions of exercises contained in the above DSP lab textbook.

my_Re_IDCT(X)
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:
for n=1:N/2
    x(2*n-1) = X1(n);
    x(2*n)     = X1(N+1-n);
end

Contact us