Followings are the code that I wrote in Octave to creates all the plots shown in this page. You may copy these code and play with these codes. Change variables and try yourself until you get your own intuitive understanding.
< Code 1 >
theta = (1.0*pi:pi/100:1.0*pi)+0.0001;
k = 1;
d = 2;
Psi = k*d*cos(theta);
N = 16;
a_theta_sum = sin(N .* Psi ./ 2) ./ (N .* sin(Psi ./ 2));
a_theta_sum_abs = abs(a_theta_sum);
a_theta_sum_abs = a_theta_sum_abs ./ max(a_theta_sum_abs);
a_theta_sum_abs_dB = 10 .* log(a_theta_sum_abs);
for i = 1:length(a_theta_sum_abs_dB)
if a_theta_sum_abs_dB(i) <= 30
a_theta_sum_abs_dB(i) = 30;
end;
end;
a_theta_sum_abs_dB = a_theta_sum_abs_dB  min(a_theta_sum_abs_dB);
a_theta_sum_abs_dB = a_theta_sum_abs_dB/max(a_theta_sum_abs_dB);
hFig = figure(1,'Position',[300 300 700 600]);
subplot(2,2,1);
plot(theta,a_theta_sum_abs);
xlim([pi pi]);
tStr = sprintf("N = %d",N);
title(tStr);
set(gca,'xtick',[pi (3/4)*pi pi/2 pi/4 0 pi/4 pi/2 (3/4)*pi pi]);
set(gca,'xticklabel',{'pi','3pi/4','pi/2' 'pi/4' '0' 'pi/4' 'pi/2','3pi/4','pi'});
subplot(2,2,2);
polar(theta,a_theta_sum_abs,'r');
t = findall(gcf,'type','text');
%delete(t);
subplot(2,2,3);plot(theta,10 .* log(a_theta_sum_abs));ylim([30 1]);
xlim([pi pi]);
tStr = sprintf("N = %d",N);
title(tStr);
set(gca,'xtick',[pi (3/4)*pi pi/2 pi/4 0 pi/4 pi/2 (3/4)*pi pi]);
set(gca,'xticklabel',{'pi','3pi/4','pi/2' 'pi/4' '0' 'pi/4' 'pi/2','3pi/4','pi'});
subplot(2,2,4);
polar(theta,a_theta_sum_abs_dB,'r');
t = findall(gcf,'type','text');
