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 [x X] = zero_phase_dft(x)
% This function is an implementation of the "zero phase DFT" of a given
% symmetric (zero-phase and noncausal) sequence x[n].
% It is assumed that x[n] is symmetric around zero (therefore of odd length and noncausal).
% This routine makes x[n] causal by circular shifting it about the middle point.
% Make sure x is row vector for subsequent processing:
x = x(:).';
N = length(x);
% Circularly shift half of the sequence to make it symmetric around
% the middle sample (N-1)/2.
% x = [x((N+1)/2:end) x(1:(N-1)/2)]; or using cirshift.m :
x = circshift(x,[0 (N+1)/2]);
% Now compute the DFT of x[n]:
X = my_DFT(x);