I wanted to verify the fact that main lobe width of a Hann/Hamming window is twice that of a rectangular window, using Matlab. I computed the analytical expressions for the respective frequency responses, and plotted them. I do not get the expected result. Can someone explain this?
Code :
omega = -pi:0.01:pi;
N = 20;
fn = exp(-j*omega*(N/2 - 0.5)).*((sin(omega*N/2))./(sin(omega/2)));
shift = (length(omega)-1)/(N-1); % 2pi/(N-1); length(omega) = 2*pi
fn2 = 0.54*fn' + 0.23*circshift(fn',ceil(shift)) + 0.23*circshift(fn',-ceil(shift));
plot(abs(fn)/max(abs(fn)))
hold on
plot(abs(fn2)/max(abs(fn2)),'r')
This is the plot :
As you can see, neither is the main lobe wider, nor are the side lobes smaller.