# Add in translated copies of Hann window shifted by 1/4 the window length.
# This gives a function that is constanct (except near the ends)
N = 1024
t = 2*pi*(0:(N-1))/N - pi
w = (1 + cos(t))/2 # our Hann window
H = N/4
H = N/8
K = 10
z = rep(0,N + K*H)
for (k in 0:(K-1)) {
range = (1+(k*H)): (k*H + N)
z[range] = z[range] + w^2
}
plot(z,type='l')
for (k in 0:(K-1)) {
range = (1+(k*H)): (k*H + N)
lines(range,w^2,col=k)
}