Contents
1.4 MATLAB Program and Function Listings............................................................3
1.5....................................................................................................................................3
1.6 MATLAB Program and Function Listings............................................................3
1.6.1 BeamwidthCalculator.m..................................................................................3
1.6.2 Compute_1D_AF.m (Function).......................................................................3
1.6.3 Compute_1D_EP.m (Function).......................................................................4
1.6.4 Compute_1D_PAT (Function)........................................................................ 4
1.6.5 process_vector.m (Function)........................................................................... 4
1.6.6 Pattern1D.m.....................................................................................................5
1.6.7 Pattern1D_GLs.m............................................................................................7
1.6.8 Pattern1D_IBW.m........................................................................................... 9
1.6.9 Taylor.m (Function).......................................................................................11
1.6.10 AmpWeightsCompare.m............................................................................. 12
1.6.11 Pattern1D_ConformalArray.m.................................................................... 13
2.6 MATLAB Program and Function Listings..........................................................15
2.6.1 Compute_2D_AF.m (Function).....................................................................15
2.6.2 Compute_2D_AFquant.m (Function)............................................................15
2.6.3 Compute_2D_EP.m (Function).....................................................................16
2.6.4 Compute_2D_PAT.m (Function).................................................................. 17
2.6.5 Compute_2D_INTGAIN.m (Function).........................................................17
2.6.6 process_matrix.m (Function).........................................................................18
2.6.7 process_matrix2.m (Function)......................................................................18
2.6.8 Taylor.m (Function).......................................................................................18
2.6.9 Pattern2D.m...................................................................................................19
2.6.10 GratingLobePlotter.m..................................................................................28
3.5 MATLAB Program Listings................................................................................30
3.5.1 Compute_1D_AF.m (Function).....................................................................30
3.5.2 Compute_1D_EP.m (Function).....................................................................30
3.5.3 Compute_1D_PAT (Function)...................................................................... 30
3.5.4 process_vector.m (Function)......................................................................... 31
3.5.5 Taylor.m (Function).......................................................................................31
3.5.6 Subarray1D.m................................................................................................32
3.5.7 Subarray1D_DBF.m......................................................................................35
3.5.8 Subarray1D_Overlapped.m........................................................................... 38
4.4 MATLAB Program and Function Listings..........................................................43
4.4.1 simpleCostFunction.m...................................................................................43
4.4.2 simpleGA_AmpTaperEx.m...........................................................................44
4.4.3 simpleGA_FlattopEx.m.................................................................................49
4.4.4 simpleGA_PhaseOnlyEx.m...........................................................................54
4.4.5 simplePS_AmpTaperEx.m............................................................................ 59
4.4.6 simplePS_FlattopEx.m.................................................................................. 63
4.4.7 simplePS_PhaseOnlyEx.m............................................................................ 67
5.6 MATLAB Program Listings................................................................................72
5.6.1 defineOrbit.m.................................................................................................72
5.6.2 defineEarth.m................................................................................................ 75
5.6.3 makeEllipse.m............................................................................................... 75
5.6.4 defineESA.m..................................................................................................76
5.6.5 los2ecef.m......................................................................................................77
5.6.6 computeHorizon.m........................................................................................ 77
5.6.7 computeFOV.m............................................................................................. 78
5.6.8 main_example1.m..........................................................................................80
5.6.9 main_example2.m..........................................................................................81
5.6.10 main_example3.m........................................................................................82
6.6 MATLAB Program Listings................................................................................86
6.6.1 Reliability Code.............................................................................................86
1.4 MATLAB Program and Function Listings
1.5
1.6 MATLAB Program and Function Listings
This section contains a listing of all MATLAB programs and functions used in this
chapter.
1.6.1 BeamwidthCalculator.m
%% This Code Plots Beamwidth vs. Frequency and Scan Angle
% Arik D. Brown
%% Input Parameters
BW.k=0.886;%Beamwidth Factor (radians)
BW.f_vec=[1 5 10 15];%Frequency in GHZ
BW.lambda_vec=0.3./BW.f_vec;%meters
BW.L=1;%Aperture Length in meters
BW.thetao_vec=0:5:60;%Degrees
%% Calculate Beamwidths
[BW.lambda_mat BW.thetao_mat]=meshgrid(BW.lambda_vec,BW.thetao_vec);
BW.mat_rad=BW.k*BW.lambda_mat./(BW.L*cosd(BW.thetao_mat));
BW.mat_deg=BW.mat_rad*180/pi;
%% Plot
figure(1),clf
plot(BW.thetao_mat,BW.mat_deg,'linewidth',2)
grid
set(gca,'fontsize',16,'fontweight','b')
xlabel('Scan Angle (Degrees)','fontsize',16,'fontweight','b')
ylabel('Beamwidth (degrees)','fontsize',16,'fontweight','b')
legend('1 GHz','5 GHz','10 GHz','15 GHz')
1.6.2 Compute_1D_AF.m (Function)
%% Function to Compute 1D AF
% Arik D. Brown
function [AF, AF_mag, AF_dB, AF_dBnorm] =...
Compute_1D_AF(wgts,nelems,d_in,f_GHz,fo_GHz,u,uo)
lambda=11.803/f_GHz;%wavelength(in)
lambdao=11.803/fo_GHz;%wavelength at tune freq(in)
k=2*pi/lambda;%rad/in
ko=2*pi/lambdao;%rad/in
AF=zeros(1,length(u));
for ii=1:nelems
AF = AF+wgts(ii)*exp(1j*(ii-(nelems+1)/2)*d_in*(k*u-ko*uo));
end
[AF_mag AF_dB AF_dBnorm] = process_vector(AF);
1.6.3 Compute_1D_EP.m (Function)
%% Function to Compute 1D EP
% Arik D. Brown
function [EP, EP_mag, EP_dB, EP_dBnorm] =...
Compute_1D_EP(theta_deg,EF)
EP=zeros(size(theta_deg));
EP=(cosd(theta_deg).^(EF/2));%Volts
[EP_mag, EP_dB, EP_dBnorm] = process_vector(EP);
1.6.4 Compute_1D_PAT (Function)
%% Function to Compute 1D PAT
% Arik D. Brown
function [PAT, PAT_mag, PAT_dB, PAT_dBnorm] =...
Compute_1D_PAT(EP,AF)
PAT=zeros(size(AF));
PAT=EP.*AF;
[PAT_mag PAT_dB PAT_dBnorm] =...
process_vector(PAT);
1.6.5 process_vector.m (Function)
function[vectormag,vectordB,vectordBnorm] = process_vector(vector)
vectormag=abs(vector);
vectordB=20*log10(vectormag+eps);
vectordBnorm=20*log10((vectormag+eps)/max(vectormag));
1.6.6 Pattern1D.m
% 1D Pattern Code
% Computes Element Pattern (EP), Array Factor(AF)and array pattern (EP*AF)
% Arik D. Brown
clear all
%% Input Parameters
%ESA Parameters
%ESA opearating at tune freq
array_params.f=10;%Operating Frequency in GHz
array_params.fo=10;%Tune Frequency in GHz of the Phase Shifter,
array_params.nelem=30;%Number of Elements
array_params.d=0.5*(11.803/array_params.fo);%Element Spacing in Inches
array_params.EF=1.35;%EF
array_params.wgtflag=1;%0 = Uniform, 1 = Taylor Weighting
%$$$$These Parameters Only Used if array_params.wgtflag=1;
array_params.taylor.nbar=5;
array_params.taylor.SLL=30;%dB value
%Theta Angle Parameters
theta_angle.numpts=721;%Number of angle pts
theta_angle.min=-90;%degrees
theta_angle.max=90;%degrees
theta_angle.scan=0;%degrees
plotcommand.EP=0;%Plot EP if = 1
plotcommand.AF=0;%Plot EP if = 1
plotcommand.PAT=1;%Plot PAT if = 1
plotcommand.ALL=0;%Plot All patterns overlaid if = 1
%% Compute Patterns
if array_params.wgtflag==0
array_params.amp_wgts=ones(array_params.nelem,1);
else
array_params.amp_wgts=Taylor(array_params.nelem,array_params.taylor.SLL,...
array_params.taylor.nbar);
end
theta_angle.vec=linspace(theta_angle.min,theta_angle.max,...
theta_angle.numpts);%degrees
theta_angle.uvec=sind(theta_angle.vec);
theta_angle.uo=sind(theta_angle.scan);
%Initialize Element Pattern, Array Factor and Pattern
array.size=size(theta_angle.vec);
array.EP=zeros(array.size);%EP
array.AF=zeros(array.size);%AF
array.PAT=zeros(array.size);
%% Compute Patterns
%Compute AF1
[array.AF, array.AF_mag, array.AF_dB, array.AF_dBnorm]=...
Compute_1D_AF(array_params.amp_wgts,array_params.nelem,...
array_params.d,array_params.f,array_params.fo,...
theta_angle.uvec,theta_angle.uo);
%Compute EP
[array.EP, array.EP_mag, array.EP_dB, array.EP_dBnorm]=...
Compute_1D_EP(theta_angle.vec,array_params.EF);
%Compute PAT
[array.PAT, array.PAT_mag, array.PAT_dB, array.PAT_dBnorm] =...
Compute_1D_PAT(array.EP,array.AF);
%% Plotting
if plotcommand.EP == 1
%Plot EP in dB, Normalized
figure,clf
set(gcf,'DefaultLineLineWidth',2.5)
plot(theta_angle.vec,array.EP_dBnorm,'--','color',[0 0 0]),hold
grid
axis([-90 90 -50 0])
set(gca,'FontSize',16,'FontWeight','bold')
title(['Element Pattern'])
xlabel('\theta (degrees)'),ylabel('dB')
end
if plotcommand.AF == 1
%Plot PAT in dB, Normalized
figure,clf
set(gcf,'DefaultLineLineWidth',2.5)
plot(theta_angle.vec,array.AF_dBnorm,'color',[0 .7 0])
grid
axis([-90 90 -50 0])
set(gca,'FontSize',16,'FontWeight','bold')
title(['Linear ',num2str(array_params.nelem),' Element Array Array Factor'])
xlabel('\theta (degrees)'),ylabel('dB')
end
if plotcommand.PAT == 1
%Plot PAT in dB, Normalized
figure,clf
set(gcf,'DefaultLineLineWidth',2.5)
plot(theta_angle.vec,array.PAT_dBnorm+array.EP_dBnorm,'color',[0 0 1]),hold
grid
axis([-90 90 -50 0])
set(gca,'FontSize',16,'FontWeight','bold')
title(['Linear ',num2str(array_params.nelem),' Element Array Pattern'])
xlabel('\theta (degrees)'),ylabel('dB')
end
if plotcommand.ALL == 1
%Plot ALL in dB, Normalized
figure,clf
set(gcf,'DefaultLineLineWidth',2.5)
plot(theta_angle.vec,array.EP_dBnorm,'--','color',[0 0 0]),hold
plot(theta_angle.vec,array.AF_dBnorm,'color',[0 .7 0])
plot(theta_angle.vec,array.PAT_dBnorm+array.EP_dBnorm,'b-')
grid
axis([-90 90 -50 0])
% axis([50 70 -20 0])
set(gca,'FontSize',16,'FontWeight','bold')
title(['Linear ',num2str(array_params.nelem),' Element Array'])
xlabel('\theta (degrees)'),ylabel('dB')
legend('EP','AF','PAT = EP * AF')
end
1.6.7 Pattern1D_GLs.m
% 1D Pattern Code
% Computes Patterns for Different Element Spacing to Illustrate Grating
% Lobes
% Arik D. Brown
clear all
%% Input Parameters
%ESA Parameters
%ESA opearating at tune freq
array_params.f=10;%Operating Frequency in GHz
array_params.fo=10;%Tune Frequency in GHz of the Phase Shifter,
array_params.nelem=30;%Number of Elements
array_params.d1=0.5*(11.803/array_params.fo);%Element Spacing in Inches
array_params.d2=1*(11.803/array_params.fo);%Element Spacing in Inches
array_params.d3=2*(11.803/array_params.fo);%Element Spacing in Inches
array_params.EF=1.35;%EF
array_params.amp_wgts=ones(array_params.nelem,1);
%Theta Angle Parameters
theta_angle.numpts=721;%Number of angle pts
theta_angle.min=-90;%degrees
theta_angle.max=90;%degrees
theta_angle.scan=0;%degrees
%% Compute Patterns
theta_angle.vec=linspace(theta_angle.min,theta_angle.max,...
theta_angle.numpts);%degrees
theta_angle.uvec=sind(theta_angle.vec);
theta_angle.uo=sind(theta_angle.scan);
%Initialize Element Pattern, Array Factor and Pattern
array.size=size(theta_angle.vec);
array.EP=zeros(array.size);%EP
array.AF1=zeros(array.size);%AF1
array.AF2=zeros(array.size);%AF2
array.AF3=zeros(array.size);%AF3
array.PAT1=zeros(array.size);%Pattern 1
array.PAT2=zeros(array.size);%Pattern 2
array.PAT3=zeros(array.size);%Pattern 3
%% Compute Patterns
%Compute AF1
[array.AF1, array.AF1_mag, array.AF1_dB, array.AF1_dBnorm]=...
Compute_1D_AF(array_params.amp_wgts,array_params.nelem,...
array_params.d1,array_params.f,array_params.fo,...
theta_angle.uvec,theta_angle.uo);
%Compute AF2
[array.AF2, array.AF2_mag, array.AF2_dB, array.AF2_dBnorm]=...