% linear array along x to scan +/- in theta
% to check series feed phase shift
clear
rad=pi/180;
N=10;
f=350e6;
wave=3e8/f;
d=0.5;
L=0.75; 
k=2*pi/wave;
alpha=-k*L;
% uniform amplitudes
t1=-90;
t2=90;
dt=1;
nt=floor((t2-t1)/dt)+1;
for i=1:nt
    th(i)=t1+(i-1)*dt; thr=th(i)*rad;
    AF=N;
    psi=k*d*sin(thr)+alpha;
    if abs(psi)>1e-4
        AF=sin(N*psi/2)/sin(psi/2);
    end
    E(i)=abs(AF)/N;
end
Edb=20*log10(E+1e-6);
figure(1)
plot(th,Edb)
xlabel('\theta (degrees)')
ylabel('Relative power, dB')
axis([-90,90,-40,0])
grid