function X = dtft(x,M) N = length(x); X = zeros(1,M); if(M > N) X(1:N) = x; else X(1:M) = x(1:M); end X = fft(X); X = fftshift(X);