%Generate Hamming window of length M in vector of length n, start at j=m go to %j=m+M-1. Centers window at j = m+(M-1)/2, truncates to zero for jm+M-1. Assumes vector is indexed starting at j = 0. function y = hammingwindow(n, m, M) y = zeros(1,n); t = 2*pi*[0:M]/M; y(m:m+M) = 0.54 - 0.46*cos(t); y = y(1:n);