w1= ones(1,51);
w2=bartlett(51);
w3=hanning(51);
w4=hamming(51);
w5=blackman(51);


W1= abs(fft(w1,1024));
W2= abs(fft(w2,1024));
W3= abs(fft(w3,1024));
W4= abs(fft(w4,1024));
W5= abs(fft(w5,1024));
omega= linspace(0,pi,512)

A1= 20*log10(W1/max(W1));
A2= 20*log10(W2/max(W2));
A3= 20*log10(W3/max(W3));
A4= 20*log10(W4/max(W4));
A5= 20*log10(W5/max(W5));


figure;
subplot(2,1,1), plot(w1)
subplot(2,1,2), plot(omega,A1(1:512)), hold on; plot(omega,-3,'-r')


figure;
subplot(2,1,1), plot(w2)
subplot(2,1,2), plot(omega,A2(1:512))

figure;
subplot(2,1,1), plot(w3)
subplot(2,1,2), plot(omega,A3(1:512))

figure;
subplot(2,1,1), plot(w4)
subplot(2,1,2), plot(omega,A4(1:512))

figure;
subplot(2,1,1), plot(w5)
subplot(2,1,2), plot(omega,A5(1:512))
