MATLAB Hamming window I have been trying to achieve a Hamming window length of 23 using the equation.
I tried several coding, one of the is the one below:
M=23
w = .54 + .46*cos(pi*(-M:M-1)'/M)
plot(w)
If the length of the window should be $23$, $M$ must equal $(23-1)/2=11$:


M = 11;
m = -M:M;
w = .54 + .46*cos(pi*m/M);
plot(m,w)