N = 256;
w = hamming(N); w1 = w / sum(w);
w = hanning(N); w2 = w / sum(w);
w = ones(N,1); w3 = w / sum(w);

sw1 = abs(freqz(w1,1,512));
sw2 = abs(freqz(w2,1,512));
sw3 = abs(freqz(w3,1,512));
f = (0:511)'/512;
plot(f,20*log10([sw1 sw2 sw3]));
