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_DTFT4(x,n)
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].
%
%Output Arguments:
% 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);

Contact us