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_Co_IDCT(X)
function x = my_Co_IDCT(X)
% Inverse Discrete Cosine Transform Computation.
% This function computes the inverse DCT of a complex input signal X[k] 
% stored in vector X by use of it's relationship with the DFT.

% First convert input vector X to a row vector for subsequent processing:
X = X(:).';
N = length(x);

% Create the "inverse" phasor with appropriate scaling:
k = 0:N-1;
phasor = sqrt(2*N)*exp(1i*k*pi/(2*N));
phasor(1) = phasor(1)*sqrt(2);

 % Multiply the elements of X with the complex phasor:
 Y = zeros(1,2*N);
 Y(1:N) = phasor.*X;
 Y(N+2:2*N) = -1i*phasor(2:N).*fliplr(X(2:N));
  
y = ifft(Y);  % Take the 2N-point inverse DFT of the new sequence.

x = y(1:N); % Keep only the first N samples.

Contact us