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 [w1 X] = my_DTFT2(x,n,w)
% DTFT Computation using the definition formula.
% Input Arguments:
% x[n] : the discrete time signal whose DTFT is to be computed.
% n : a vector that contains the time indices of the domain of x[n].
% w : is 1X2 a vector containing the frequency interval bounds where the DTFT is to be computed.
% X[k]: a vector containing the DTFT of x[n] computed at frequencies in w.
% w1 : is a vector containing the samples of the frequency interval where the DTFT is to be computed.
% Caution: Vectors w1 and X are (2*NSamples+1) samples long.
x = x(:).';
% 2^11 samples to describe half of the frequency interval [w(1) w(2)] are considered sufficient!
NSamples = 2048;
w1 = w(1):(w(end) - w(1))/(2*NSamples):w(end); % length(w1) = length(X) = 2*NSamples + 1.
X = zeros(1,2*NSamples + 1);
for k = 1:2*NSamples + 1
W = exp(-1i*w1(k)*n);
X(k) = W*x.';