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_DFT2(x)
function  X = my_DFT2(x)
% Direct DFT Computation using the definition formula.
% Input Arguments:
% x[n] : the discrete time signal whose DFT is to be computed.
% 
%Output Arguments:
% X[k]: a vector containing the DFT of x[n] calculated and frequency indices k.
N = length(x);
X = zeros(1,N);

for k = 0:N-1 
    for n = 0:N-1
          X(k+1) = X(k+1) + x(n+1)*exp(-1i*2*pi*n*k/N);
    end
end

Contact us