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_DFT(x)
function  X = my_DFT(x)
% This function calculates the DFT of the input signal x.
% Input: x is a row vector that contains the signal who's DFT is to be computed.
% Output: X is a row vector containing the DFT of x[n].

% First create the twiddle factors matrix W:
N = length(x);
n = 0:N-1;
w = exp(-1i*2*pi*n/N);
W = zeros(N,N);
for k=0:N-1
      W(:,k+1) = w.^k;
end

% Compute the DFT as a product of the twiddle factors matrix with input vector x:
X = x*W;    

Contact us