Below is a MatLab code that computes an antenna pattern, normalizes the results to the peak, and plots the results as a function of theta:

kh=(2*pi);

theta(1)=0;

for i=1:1000

r(i)=sin(theta(i))*2*cos(kh*cos(theta(i)));

if(i<1000)

theta(i+1)=theta(i)+pi/1000;

end

end

dB=20*log(r/max(r));

plot(theta,dB)

axis([0 pi -70 0])

title('Plot of Radiation Pattern for l=10\lambda (the increase in # of lobes is significant)')

xlabel('\theta')

ylabel('dB')

kh=(2*pi);

theta(1)=0;

for i=1:1000

r(i)=sin(theta(i))*2*cos(k

if(i<1000)

theta(i+1)=theta(i)+pi/100

end

end

dB=20*log(r/max(r));

plot(theta,dB)

axis([0 pi -70 0])

title('Plot of Radiation Pattern for l=10\lambda (the increase in # of lobes is significant)')

xlabel('\theta')

ylabel('dB')