%ArrayPatGain - This program is an updated and combined version of the programs "ANTGAIN % and "ARRAYPATGAIN" in the 4th edition of Kraus's Electromagnetics. This program % computes and plots the field pattern of a uniform linear array of sources. clear; timesrun=0; while timesrun<1000, if timesrun==0, SP=0.5; PH=0; N=5; MF=1; else, SP=input('Enter element spacing in wavelengths: '); PH=input('Enter phase difference between elements in degrees: '); N=input('Enter number of elements: '); MF=input('Enter pattern multiplication factor: ')'; end; % This version modified to include isotropic AND short dipole sources % both of which are displayed on the same polar plot. This version % does not do phase plots. % F. Merat 3/29/03 % Compute fields for plotting A=0.01:0.01:6.27; % Angle over 2pi radians U=(2*pi*SP*cos(A)+(pi*PH/180))/2; % compute argument FP=(sin(N*U)./sin(U)); % compute isotropic electric field FPD=(sin(N*U)./sin(U)).*cos(A); % computer dipole electric field R=MF.*abs(FP); % multiply as appropriate Rdipole=MF.*abs(FPD); % compute for array of short dipoles pause(0.9); % compute the beam area in theta B=0.01:0.01:3.14; % B is theta -- the angle from 0 degrees % 0