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 [w X] = my_DTFT4(x,n)
% DTFT Computation using the matrix multiplication method.
% Input Arguments:
% x[n] : the discrete time signal whose DTFT is to be computed.
% n : a vector that contains the time indices (i.e. the domain) of x[n].
% w : a vector containing a sampled version of the [-pi pi] digital frequency interval.
% X[k]: a vector containing the DTFT of x[n] computed at frequencies given in w.
% Caution: The output vectors w and X are (2*NSamples+1)-point long.
% 2^10 samples to describe the frequency interval (0,pi] are considered sufficient!
M = 1024; % Frequency resolution for (0 pi].
k = -M:M;
w = pi*k/M;
X = zeros(1,2*M+1);
X = x * (exp(-1i*pi/M)) .^ (n.'*k);