function I = PhasedArrayPlot(N,d,a,lambda,td)
%N is the number of elements
%d is the distance between elements (center to center)
%a is the width of one element
%lambda is the wavelength
%td is the group time delay

theta = linspace(-90,90,10000);          %Create the angle vector to plot against
phi = td/lambda*343.3;

A = sin(pi*a.*sind(theta)/lambda);
B = pi*a.*sind(theta)/lambda;
C = ((2*pi*d.*sind(theta)/lambda)+phi);
D = sin((N/2).*C);
E = sin(C);
I = ((A./B).^2).*((D./E).^2);

figure(1)
plot(theta,I,'b')
xlabel('Viewing Angle Theta')
ylabel('Intensity of the Wave')
title('Intensity vs Theta');

figure(2)
semilogy(theta,I,'b')
xlabel('Viewing Angle Theta')
ylabel('Intensity of the Wave')
title('Intensity vs Theta');
