TFD Array Analysis - Element Factors, Array Factors, and Phased Array Beam Steering
May, 2014

Array Functions
	Array functions for the EW and NW dipole groups.

(********************************************************************************************)
(*                                                                                          *)
(*  Constants definitions section                                                           *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Speed of light in a vacuum *)
c=299792458;

(* Meters in one foot *)
f2m = 0.3048;


(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];

(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in x direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
(* y = degrees off axis in y direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
(* f = RF frequency being considered *)
AF[x_,dx_,nx_,y_,dy_,ny_,f_]:=10 Log10[(((Sin[((nx π dx f2m f)/c) Sin[x(π/180)]])^2)/((nx^2) ((Sin[((π dx f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((ny π dy f2m f)/c) Sin[y(π/180)]])^2)/((ny^2) ((Sin[((π dy f2m f)/c) Sin[y(π/180)]])^2)))];


(********************************************************************************************)
(*                                                                                          *)
(*  Main program code                                                                       *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Plot aray function for NS wires*)
f=32000000;
dx=32;
nx=2;
dy=64;
ny=2;
Plot3D[AF[x,dx,nx,y,dy,ny,f],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
ViewPoint->{1.783,-2.342,1.668}
]
f=32000000;
dx=32;
nx=1;
dy=32;
ny=4;
Plot3D[AF[x,dx,nx,y,dy,ny,f],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
ViewPoint->{1.783,-2.342,1.668}
]

(* Plot aray function for EW wires*)
f=24000000;
dx=32;
nx=1;
dy=32;
ny=4;
Plot3D[AF[x,dx,nx,y,dy,ny,f],{x,-60,60},{y,-60,60},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
AxesLabel->{"EW","NS","Gain"},
LabelStyle->Directive[Blue,Bold,Large]
]

Element Functions
	Element functions.

(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];


(* Define element factors *)
(* x = degrees off axis in noted direction *)
EFbroadside[x_]:=-4.921 10^-12 x^6+2.304 10^-9 x^5-2.656 10^-7 x^4+9.289 10^-6 x^3-1.775 10^-4 x^2+1.238 10^-3 x+0.9980/;0≤x≤90;
EFbroadside[x_]:=-4.921 10^-12 (-x)^6+2.304 10^-9 (-x)^5-2.656 10^-7 (-x)^4+9.289 10^-6 (-x)^3-1.775 10^-4 (-x)^2+1.238 10^-3 (-x)+0.9980/;-90≤x<0;
EFinplane[x_]:=2.015 10^-11 x^6-4.473 10^-9 x^5+2.286 10^-7 x^4+1.214 10^-5 x^3-1.154 10^-3 x^2+2.270 10^-3 x+0.9958/;0≤x≤90;
EFinplane[x_]:=2.015 10^-11 (-x)^6-4.473 10^-9 (-x)^5+2.286 10^-7 (-x)^4+1.214 10^-5 (-x)^3-1.154 10^-3 (-x)^2+2.270 10^-3 (-x)+0.9958/;-90≤x<0;


(* Plot element functions *)
Plot[{EFbroadside[x],EFinplane[x]},{x,-90,90}]

Array Functions + Element Functions
	Array functions for the EW and NW dipole groups multiplied by the appropriate element functions.

(********************************************************************************************)
(*                                                                                          *)
(*  Constants definitions section                                                           *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Speed of light in a vacuum *)
c=299792458;

(* Meters in one foot *)
f2m = 0.3048;


(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];


(* Define element factors *)
(* x = degrees off axis in noted direction *)
EFbroadside[x_]:=-4.921 10^-12 x^6+2.304 10^-9 x^5-2.656 10^-7 x^4+9.289 10^-6 x^3-1.775 10^-4 x^2+1.238 10^-3 x+0.9980/;0≤x≤90;
EFbroadside[x_]:=-4.921 10^-12 (-x)^6+2.304 10^-9 (-x)^5-2.656 10^-7 (-x)^4+9.289 10^-6 (-x)^3-1.775 10^-4 (-x)^2+1.238 10^-3 (-x)+0.9980/;-90≤x<0;
EFinplane[x_]:=2.015 10^-11 x^6-4.473 10^-9 x^5+2.286 10^-7 x^4+1.214 10^-5 x^3-1.154 10^-3 x^2+2.270 10^-3 x+0.9958/;0≤x≤90;
EFinplane[x_]:=2.015 10^-11 (-x)^6-4.473 10^-9 (-x)^5+2.286 10^-7 (-x)^4+1.214 10^-5 (-x)^3-1.154 10^-3 (-x)^2+2.270 10^-3 (-x)+0.9958/;-90≤x<0;

(* Define total functions as array functions multitplied by element finctions *)
(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in x direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
(* y = degrees off axis in y direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
(* f = RF frequency being considered *)

(* NS wires *)
TF1[x_,dx_,nx_,y_,dy_,ny_,f_]:=10 Log10[(((Sin[((nx π dx f2m f)/c) Sin[x(π/180)]])^2)/((nx^2) ((Sin[((π dx f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((ny π dy f2m f)/c) Sin[y(π/180)]])^2)/((ny^2) ((Sin[((π dy f2m f)/c) Sin[y(π/180)]])^2))) EFbroadside[x] EFinplane[y]];

(* EW wires *)
TF2[x_,dx_,nx_,y_,dy_,ny_,f_]:=10 Log10[(((Sin[((nx π dx f2m f)/c) Sin[x(π/180)]])^2)/((nx^2) ((Sin[((π dx f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((ny π dy f2m f)/c) Sin[y(π/180)]])^2)/((ny^2) ((Sin[((π dy f2m f)/c) Sin[y(π/180)]])^2))) EFbroadside[y] EFinplane[x]];


(********************************************************************************************)
(*                                                                                          *)
(*  Main program code                                                                       *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Plot aray function for NS wires*)
f=24000000;
dx=32;
nx=2;
dy=64;
ny=2;
Plot3D[TF1[x,dx,nx,y,dy,ny,f],{x,-60,60},{y,-60,60},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24]
]
ContourPlot[TF1[x,dx,nx,y,dy,ny,f]==-3,{x,-30,30},{y,-30,30}]
Plot[{TF1[0.001,dx,nx,x,dy,ny,f],TF1[x,dx,nx,0.001,dy,ny,f]},{x,0.001,30},PlotRange->{-6,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-3,Red},-6}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Gain (dB)",""},{"Off Axis (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLegends->Placed[{Style["North-South",FontSize->24,Bold,FontFamily->Helvetica],Style["East-West",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]


f=24000000;
dx=32;
nx=1;
dy=32;
ny=4;
Plot3D[TF2[x,dx,nx,y,dy,ny,f],{x,-60,60},{y,-60,60},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24]
]
ContourPlot[TF2[x,dx,nx,y,dy,ny,f]==-3,{x,-30,30},{y,-30,30}]
Plot[{TF2[0.001,dx,nx,x,dy,ny,f],TF2[x,dx,nx,0.001,dy,ny,f]},{x,0.001,30},PlotRange->{-6,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-3,Red},-6}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Gain (dB)",""},{"Off Axis (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLegends->Placed[{Style["North-South",FontSize->24,Bold,FontFamily->Helvetica],Style["East-West",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]

Array Functions + Element Functions  with EW & NS Wires Convolved 16 MHz
	Array functions for the EW and NW dipole groups multiplied by the appropriate element functions.

(********************************************************************************************)
(*                                                                                          *)
(*  Constants definitions section                                                           *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Speed of light in a vacuum *)
c=299792458;

(* Meters in one foot *)
f2m = 0.3048;

(* f = RF frequency being considered (Hertz) *)
f=16000000;

(* Parameters for North-South dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxns=32;
nxns=2;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyns=64;
nyns=2;

(* Parameters for East-West dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxew=32;
nxew=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyew=32;
nyew=4;


(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];

(* Define element factors *)
(* x = degrees off axis in noted direction *)
EF16broadside[x_]:=-3.352 10^-12 x^6+1.279 10^-9 x^5-1.257 10^-7 x^4+4.216 10^-6 x^3-2.036 10^-4 x^2+6.240 10^-4 x+0.9995/;0≤x≤90;
EF16broadside[x_]:=-3.325 10^-12 (-x)^6+1.279 10^-9 (-x)^5-1.257 10^-7 (-x)^4+4.216 10^-6 (-x)^3-2.036 10^-4 (-x)^2+6.240 10^-4 (-x)+0.9995/;-90≤x<0;
EF16inplane[x_]:=1.975 10^-11 x^6-5.024 10^-9 x^5+3.838 10^-7 x^4-1.768 10^-6 x^3-7.095 10^-4 x^2+2.942 10^-4 x+0.99999/;0≤x≤90;
EF16inplane[x_]:=1.975 10^-11 (-x)^6-5.024 10^-9 (-x)^5+3.838 10^-7 (-x)^4-1.768 10^-6 (-x)^3-7.095 10^-4 (-x)^2+2.942 10^-4 (-x)+0.99999/;-90≤x<0;

(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
AF116[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2)))];


(* EW wires *)
AF216[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2)))];

(* All 8 elements *)
AF316[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) (((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2)))];

(* Define total functions as array functions multitplied by element functions *)
(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
TF116[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) EF16broadside[x] EF16inplane[y]];


(* EW wires *)
TF216[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2))) EF16broadside[y] EF16inplane[x]];

(* Define Array Pattern for entire array of 8 elements *)
AP16[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) EF16broadside[x] EF16inplane[y] (((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2))) EF16broadside[y] EF16inplane[x]];


(********************************************************************************************)
(*                                                                                          *)
(*  Main program code                                                                       *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)
(* ,ViewPoint->{1.7748,-2.3687,1.6399} *)

(* Plot aray function for NS wires*)
Plot3D[AF116[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["NS Wires Array Factor at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

(* Plot aray function for EW wires*)
Plot3D[AF216[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["EW Wires Array Factor at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

(* Plot aray function for 8 wires*)
Plot3D[AF316[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["Total Array Factor at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

(* Plot function for NS wires*)
Plot3D[TF116[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array NS Elements Pattern at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]
(*
ContourPlot[TF116[x,y]==-3,{x,-30,30},{y,-20,20},
ContourStyle->{Thick,Blue},
GridLines->{{-25,-20,-15,-10,-5,0,5,10,15,20,25},{-15,-10,-5,0,5,10,15}},
GridLinesStyle->Thin,
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array NS Elements HPBW at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]]

Plot[{TF116[0.001,x],TF116[x,0.001]},{x,0.001,30},PlotRange->{-6,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-3,Red},-6}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Gain (dB)",""},{"Off Axis (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLegends->Placed[{Style["North-South",FontSize->24,Bold,FontFamily->Helvetica],Style["East-West",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]
*)

(* Plot function for EW wires*)
Plot3D[TF216[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array EW Elements Pattern at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

ContourPlot[TF216[x,y]==-3,{x,-90,90},{y,-90,90},
ContourStyle->{Thick,Blue},
GridLinesStyle->Thin,
Axes->False,
AspectRatio->3/3,
Frame->True,
GridLines->{Table[i,{i,-90,90,10}],Table[i,{i,-90,90,10}]},FrameTicks->{Table[i,{i,-90,90,30}],Table[i,{i,-90,90,30}]},
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array EW Elements HPBW at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]]
(*
Plot[{TF216[0.001,x],TF216[x,0.001]},{x,0.001,30},PlotRange->{-6,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-3,Red},-6}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Gain (dB)",""},{"Off Axis (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLegends->Placed[{Style["North-South",FontSize->24,Bold,FontFamily->Helvetica],Style["East-West",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]


(* Plot difference in gain between EW & NS wires*)
(* Gains in East-West direction *)
Plot[{TF116[x,0.001],TF216[x,0.001],TF116[x,0.001]-TF216[x,0.001]},{x,0.001,30},PlotRange->{-3,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30,35,40},{{-1,Red},-2,-3}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Difference (dB)",""},{"Off Axis E-W Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["Responses in East-West Direction",FontSize->24,Bold,FontFamily->Helvetica],
PlotLegends->Placed[{Style["N-S Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["E-W Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["Difference",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]
(* Gains in North-South direction *)
Plot[{TF116[0.001,x],TF216[0.001,x],TF216[0.001,x]-TF116[0.001,x]},{x,0.001,30},PlotRange->{-3,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30,35,40},{{-1,Red},-2,-3}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Difference (dB)",""},{"Off Axis N-S Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["Responses in North-South Direction",FontSize->24,Bold,FontFamily->Helvetica],
PlotLegends->Placed[{Style["N-S Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["E-W Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["Difference",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]
*)
(* Plot Array Pattern, all 8 elements *)
Plot3D[AP16[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array Pattern at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

ContourPlot[AP16[x,y]==-3,{x,-90,90},{y,-90,90},
ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,-90,90,10}],Table[i,{i,-90,90,10}]},FrameTicks->{Table[i,{i,-90,90,30}],Table[i,{i,-90,90,30}]},
GridLinesStyle->Thin,
Axes->False,
AspectRatio->3/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array HPBW at Zenith ≈ 40° EW × 18° NS at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]
]

Element Functions  16 MHz
	Array functions for the EW and NW dipole groups multiplied by the appropriate element functions.

(********************************************************************************************)
(*                                                                                          *)
(*  Constants definitions section                                                           *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Speed of light in a vacuum *)
c=299792458;

(* Meters in one foot *)
f2m = 0.3048;

(* f = RF frequency being considered (Hertz) *)
f=16000000;

(* Parameters for North-South dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxns=32;
nxns=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyns=32;
nyns=1;

(* Parameters for East-West dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxew=32;
nxew=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyew=32;
nyew=1;


(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];

(* Define element factors *)
(* x = degrees off axis in noted direction *)
EF16broadside[x_]:=-3.352 10^-12 x^6+1.279 10^-9 x^5-1.257 10^-7 x^4+4.216 10^-6 x^3-2.036 10^-4 x^2+6.240 10^-4 x+0.9995/;0≤x≤90;
EF16broadside[x_]:=-3.325 10^-12 (-x)^6+1.279 10^-9 (-x)^5-1.257 10^-7 (-x)^4+4.216 10^-6 (-x)^3-2.036 10^-4 (-x)^2+6.240 10^-4 (-x)+0.9995/;-90≤x<0;
EF16inplane[x_]:=1.975 10^-11 x^6-5.024 10^-9 x^5+3.838 10^-7 x^4-1.768 10^-6 x^3-7.095 10^-4 x^2+2.942 10^-4 x+0.99999/;0≤x≤90;
EF16inplane[x_]:=1.975 10^-11 (-x)^6-5.024 10^-9 (-x)^5+3.838 10^-7 (-x)^4-1.768 10^-6 (-x)^3-7.095 10^-4 (-x)^2+2.942 10^-4 (-x)+0.99999/;-90≤x<0;

(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
AF116[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2)))];


(* EW wires *)
AF216[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2)))];

(* All 8 elements *)
AF316[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) (((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2)))];

(* Define total functions as array functions multitplied by element functions *)
(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
TF116[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) EF16broadside[x] EF16inplane[y]];


(* EW wires *)
TF216[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2))) EF16broadside[y] EF16inplane[x]];

(* Define Array Pattern for entire array of 8 elements *)
AP16[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) EF16broadside[x] EF16inplane[y] (((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2))) EF16broadside[y] EF16inplane[x]];


(********************************************************************************************)
(*                                                                                          *)
(*  Main program code                                                                       *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)
(* ,ViewPoint->{1.7748,-2.3687,1.6399} *)


(* Plot function for NS wires*)
Plot3D[10 Log10[EF16broadside[x] EF16inplane[y]],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"Broadside (deg)","In Plane (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array Element Factor at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

Array Functions + Element Functions  with EW & NS Wires Convolved 24 MHz
	Array functions for the EW and NW dipole groups multiplied by the appropriate element functions.

(********************************************************************************************)
(*                                                                                          *)
(*  Constants definitions section                                                           *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Speed of light in a vacuum *)
c=299792458;

(* Meters in one foot *)
f2m = 0.3048;

(* f = RF frequency being considered (Hertz) *)
f=24000000;

(* Parameters for North-South dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxns=32;
nxns=2;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyns=64;
nyns=2;

(* Parameters for East-West dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxew=32;
nxew=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyew=32;
nyew=4;


(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];

(* Define element factors *)
(* x = degrees off axis in noted direction *)
EF24broadside[x_]:=-4.921 10^-12 x^6+2.304 10^-9 x^5-2.656 10^-7 x^4+9.289 10^-6 x^3-1.775 10^-4 x^2+1.238 10^-3 x+0.9980/;0≤x≤90;
EF24broadside[x_]:=-4.921 10^-12 (-x)^6+2.304 10^-9 (-x)^5-2.656 10^-7 (-x)^4+9.289 10^-6 (-x)^3-1.775 10^-4 (-x)^2+1.238 10^-3 (-x)+0.9980/;-90≤x<0;
EF24inplane[x_]:=2.015 10^-11 x^6-4.473 10^-9 x^5+2.286 10^-7 x^4+1.214 10^-5 x^3-1.154 10^-3 x^2+2.270 10^-3 x+0.9958/;0≤x≤90;
EF24inplane[x_]:=2.015 10^-11 (-x)^6-4.473 10^-9 (-x)^5+2.286 10^-7 (-x)^4+1.214 10^-5 (-x)^3-1.154 10^-3 (-x)^2+2.270 10^-3 (-x)+0.9958/;-90≤x<0;

(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
AF124[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2)))];


(* EW wires *)
AF224[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2)))];

(* All 8 elements *)
AF324[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) (((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2)))];

(* Define total functions as array functions multitplied by element functions *)
(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
TF124[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) EF24broadside[x] EF24inplane[y]];


(* EW wires *)
TF224[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2))) EF24broadside[y] EF24inplane[x]];

(* Define Array Pattern for entire array of 8 elements *)
AP24[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) EF24broadside[x] EF24inplane[y] (((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2))) EF24broadside[y] EF24inplane[x]];


(********************************************************************************************)
(*                                                                                          *)
(*  Main program code                                                                       *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Plot aray function for NS wires*)
Plot3D[AF124[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["NS Wires Array Factor at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

(* Plot aray function for EW wires*)
Plot3D[AF224[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["EW Wires Array Factor at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

(* Plot aray function for 8 wires*)
Plot3D[AF324[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["Total Array Factor at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

(* Plot function for NS wires*)
Plot3D[TF124[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array NS Elements Pattern at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

(*
ContourPlot[TF124[x,y]==-3,{x,-30,30},{y,-20,20},
ContourStyle->{Thick,Blue},
GridLines->{{-25,-20,-15,-10,-5,0,5,10,15,20,25},{-15,-10,-5,0,5,10,15}},
GridLinesStyle->Thin,
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array NS Elements HPBW at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]]

Plot[{TF124[0.001,x],TF124[x,0.001]},{x,0.001,30},PlotRange->{-6,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-3,Red},-6}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Gain (dB)",""},{"Off Axis (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLegends->Placed[{Style["North-South",FontSize->24,Bold,FontFamily->Helvetica],Style["East-West",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]
*)

(* Plot function for EW wires*)
Plot3D[TF224[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array EW Elements Pattern at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

ContourPlot[TF224[x,y]==-3,{x,-90,90},{y,-90,90},
ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,-90,90,10}],Table[i,{i,-90,90,10}]},FrameTicks->{Table[i,{i,-90,90,30}],Table[i,{i,-90,90,30}]},
GridLinesStyle->Thin,
Axes->False,
AspectRatio->3/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array EW Elements HPBW at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]]

(*
Plot[{TF224[0.001,x],TF224[x,0.001]},{x,0.001,30},PlotRange->{-6,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-3,Red},-6}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Gain (dB)",""},{"Off Axis (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLegends->Placed[{Style["North-South",FontSize->24,Bold,FontFamily->Helvetica],Style["East-West",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]


(* Plot difference in gain between EW & NS wires*)
(* Gains in East-West direction *)
Plot[{TF124[x,0.001],TF224[x,0.001],TF124[x,0.001]-TF224[x,0.001]},{x,0.001,30},PlotRange->{-3,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-1,Red},-2,-3}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Difference (dB)",""},{"Off Axis E-W Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["Responses in East-West Direction",FontSize->24,Bold,FontFamily->Helvetica],
PlotLegends->Placed[{Style["N-S Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["E-W Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["Difference",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]
(* Gains in North-South direction *)
Plot[{TF124[0.001,x],TF224[0.001,x],TF224[0.001,x]-TF124[0.001,x]},{x,0.001,30},PlotRange->{-3,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-1,Red},-2,-3}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Difference (dB)",""},{"Off Axis N-S Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["Responses in North-South Direction",FontSize->24,Bold,FontFamily->Helvetica],
PlotLegends->Placed[{Style["N-S Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["E-W Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["Difference",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]
*)

(* Plot Array Pattern, all 8 elements *)
Plot3D[AP24[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array Pattern at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
(*ViewPoint->{1.7748,-2.3687,1.6399}*)
ViewPoint->{1.783,-2.342,1.668}
]

ContourPlot[AP24[x,y]==-3,{x,-90,90},{y,-90,90},
ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,-90,90,10}],Table[i,{i,-90,90,10}]},FrameTicks->{Table[i,{i,-90,90,30}],Table[i,{i,-90,90,30}]},
GridLinesStyle->Thin,
Axes->False,
AspectRatio->3/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array HPBW at Zenith ≈ 30° EW × 12° NS at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]
]

Element Function 24 MHz
	Array functions for the EW and NW dipole groups multiplied by the appropriate element functions.

(********************************************************************************************)
(*                                                                                          *)
(*  Constants definitions section                                                           *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Speed of light in a vacuum *)
c=299792458;

(* Meters in one foot *)
f2m = 0.3048;

(* f = RF frequency being considered (Hertz) *)
f=24000000;

(* Parameters for North-South dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxns=32;
nxns=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyns=64;
nyns=1;

(* Parameters for East-West dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxew=32;
nxew=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyew=32;
nyew=1;


(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];

(* Define element factors *)
(* x = degrees off axis in noted direction *)
EF24broadside[x_]:=-4.921 10^-12 x^6+2.304 10^-9 x^5-2.656 10^-7 x^4+9.289 10^-6 x^3-1.775 10^-4 x^2+1.238 10^-3 x+0.9980/;0≤x≤90;
EF24broadside[x_]:=-4.921 10^-12 (-x)^6+2.304 10^-9 (-x)^5-2.656 10^-7 (-x)^4+9.289 10^-6 (-x)^3-1.775 10^-4 (-x)^2+1.238 10^-3 (-x)+0.9980/;-90≤x<0;
EF24inplane[x_]:=2.015 10^-11 x^6-4.473 10^-9 x^5+2.286 10^-7 x^4+1.214 10^-5 x^3-1.154 10^-3 x^2+2.270 10^-3 x+0.9958/;0≤x≤90;
EF24inplane[x_]:=2.015 10^-11 (-x)^6-4.473 10^-9 (-x)^5+2.286 10^-7 (-x)^4+1.214 10^-5 (-x)^3-1.154 10^-3 (-x)^2+2.270 10^-3 (-x)+0.9958/;-90≤x<0;

(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
AF124[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2)))];


(* EW wires *)
AF224[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2)))];

(* All 8 elements *)
AF324[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) (((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2)))];

(* Define total functions as array functions multitplied by element functions *)
(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
TF124[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) EF24broadside[x] EF24inplane[y]];


(* EW wires *)
TF224[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2))) EF24broadside[y] EF24inplane[x]];

(* Define Array Pattern for entire array of 8 elements *)
AP24[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) EF24broadside[x] EF24inplane[y] (((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2))) EF24broadside[y] EF24inplane[x]];


(********************************************************************************************)
(*                                                                                          *)
(*  Main program code                                                                       *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

Plot3D[TF124[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"Broadside (deg)","In Plane (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array Element Factor at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

Array Functions + Element Functions  with EW & NS Wires Convolved 32 MHz
	Array functions for the EW and NW dipole groups multiplied by the appropriate element functions.

(********************************************************************************************)
(*                                                                                          *)
(*  Constants definitions section                                                           *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Speed of light in a vacuum *)
c=299792458;

(* Meters in one foot *)
f2m = 0.3048;

(* f = RF frequency being considered (Hertz) *)
f=32000000;

(* Parameters for North-South dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxns=32;
nxns=2;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyns=64;
nyns=2;

(* Parameters for East-West dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxew=32;
nxew=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyew=32;
nyew=4;


(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];

(* Define element factors *)
(* x = degrees off axis in noted direction *)
EF32broadside[x_]:=-4.381 10^-13 x^6+2.532 10^-9 x^5-4.150 10^-7 x^4+1.779 10^-5 x^3-1.931 10^-4 x^2+2.815 10^-3 x+0.8642/;0≤x≤90;
EF32broadside[x_]:=-4.381 10^-13 (-x)^6+2.532 10^-9 (-x)^5-4.150 10^-7 (-x)^4+1.779 10^-5 (-x)^3-1.931 10^-4 (-x)^2+2.815 10^-3 (-x)+0.8642/;-90≤x<0;
EF32inplane[x_]:=9.248 10^-12 x^6+1.430 10^-10 x^5-4.655 10^-7 x^4+5.784 10^-5 x^3-2.362 10^-3 x^2+8.604 10^-3 x+0.9859/;0≤x≤90;
EF32inplane[x_]:=9.248 10^-12 (-x)^6+1.430 10^-10 (-x)^5-4.655 10^-7 (-x)^4+5.784 10^-5 (-x)^3-2.362 10^-3 (-x)^2+8.604 10^-3 (-x)+0.9859/;-90≤x<0;

(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
AF132[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2)))];


(* EW wires *)
AF232[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2)))];

(* All 8 elements *)
AF332[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) (((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2)))];

(* Define total functions as array functions multitplied by element functions *)
(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
TF132[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) EF32broadside[x] EF32inplane[y]];


(* EW wires *)
TF232[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2))) EF32broadside[y] EF32inplane[x]];

(* Define Array Pattern for entire array of 8 elements *)
AP32[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) EF32broadside[x] EF32inplane[y] (((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2))) EF32broadside[y] EF32inplane[x]];


(********************************************************************************************)
(*                                                                                          *)
(*  Main program code                                                                       *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)
(*
(* Plot aray function for NS wires*)
Plot3D[AF132[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["NS Wires Array Factor at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

(* Plot aray function for EW wires*)
Plot3D[AF232[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["EW Wires Array Factor at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

(* Plot aray function for 8 wires*)
Plot3D[AF332[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["Total Array Factor at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

(* Plot function for NS wires*)
Plot3D[TF132[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array NS Elements Pattern at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

(*
ContourPlot[TF132[x,y]==-3,{x,-90,90},{y,-90,90},
ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,-90,90,10}],Table[i,{i,-90,90,10}]},FrameTicks->{Table[i,{i,-90,90,30}],Table[i,{i,-90,90,30}]},
GridLinesStyle->Thin,
Axes->False,
AspectRatio->3/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array NS Elements HPBW at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]]

Plot[{TF132[0.001,x],TF132[x,0.001]},{x,0.001,30},PlotRange->{-6,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-3,Red},-6}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Gain (dB)",""},{"Off Axis (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLegends->Placed[{Style["North-South",FontSize->24,Bold,FontFamily->Helvetica],Style["East-West",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]
*)

(* Plot function for EW wires*)
Plot3D[TF232[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array EW Elements Pattern at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

ContourPlot[TF232[x,y]==-3,{x,-90,90},{y,-90,90},
ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,-90,90,10}],Table[i,{i,-90,90,10}]},FrameTicks->{Table[i,{i,-90,90,30}],Table[i,{i,-90,90,30}]},
GridLinesStyle->Thin,
Axes->False,
AspectRatio->3/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array EW Elements HPBW at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]]

(*
Plot[{TF232[0.001,x],TF232[x,0.001]},{x,0.001,30},PlotRange->{-6,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-3,Red},-6}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Gain (dB)",""},{"Off Axis (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLegends->Placed[{Style["North-South",FontSize->24,Bold,FontFamily->Helvetica],Style["East-West",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]


(* Plot difference in gain between EW & NS wires*)
(* Gains in East-West direction *)
Plot[{TF132[x,0.001],TF232[x,0.001],TF132[x,0.001]-TF232[x,0.001]},{x,0.001,30},PlotRange->{-3,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-1,Red},-2,-3}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Difference (dB)",""},{"Off Axis E-W Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["Responses in East-West Direction",FontSize->24,Bold,FontFamily->Helvetica],
PlotLegends->Placed[{Style["N-S Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["E-W Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["Difference",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]
(* Gains in North-South direction *)
Plot[{TF132[0.001,x],TF232[0.001,x],TF232[0.001,x]-TF132[0.001,x]},{x,0.001,30},PlotRange->{-3,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-1,Red},-2,-3}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Difference (dB)",""},{"Off Axis N-S Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["Responses in North-South Direction",FontSize->24,Bold,FontFamily->Helvetica],
PlotLegends->Placed[{Style["N-S Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["E-W Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["Difference",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]
*)

(* Plot Array Pattern, all 8 elements *)
Plot3D[AP32[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array Pattern at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]
*)
ContourPlot[AP32[x,y]==-3,{x,-90,90},{y,-90,90},
ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,-90,90,10}],Table[i,{i,-90,90,10}]},FrameTicks->{Table[i,{i,-90,90,30}],Table[i,{i,-90,90,30}]},
GridLinesStyle->Thin,
Axes->False,
AspectRatio->3/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array HPBW at Zenith ≈ 20° EW × 8° NS at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]
]

Element Function 32 MHz
	Array functions for the EW and NW dipole groups multiplied by the appropriate element functions.

(********************************************************************************************)
(*                                                                                          *)
(*  Constants definitions section                                                           *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Speed of light in a vacuum *)
c=299792458;

(* Meters in one foot *)
f2m = 0.3048;

(* f = RF frequency being considered (Hertz) *)
f=32000000;

(* Parameters for North-South dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxns=32;
nxns=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyns=32;
nyns=1;

(* Parameters for East-West dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxew=32;
nxew=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyew=32;
nyew=1;


(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];

(* Define element factors *)
(* x = degrees off axis in noted direction *)
EF32broadside[x_]:=-4.381 10^-13 x^6+2.532 10^-9 x^5-4.150 10^-7 x^4+1.779 10^-5 x^3-1.931 10^-4 x^2+2.815 10^-3 x+0.8642/;0≤x≤90;
EF32broadside[x_]:=-4.381 10^-13 (-x)^6+2.532 10^-9 (-x)^5-4.150 10^-7 (-x)^4+1.779 10^-5 (-x)^3-1.931 10^-4 (-x)^2+2.815 10^-3 (-x)+0.8642/;-90≤x<0;
EF32inplane[x_]:=9.248 10^-12 x^6+1.430 10^-10 x^5-4.655 10^-7 x^4+5.784 10^-5 x^3-2.362 10^-3 x^2+8.604 10^-3 x+0.9859/;0≤x≤90;
EF32inplane[x_]:=9.248 10^-12 (-x)^6+1.430 10^-10 (-x)^5-4.655 10^-7 (-x)^4+5.784 10^-5 (-x)^3-2.362 10^-3 (-x)^2+8.604 10^-3 (-x)+0.9859/;-90≤x<0;

(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
AF132[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2)))];


(* EW wires *)
AF232[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2)))];

(* All 8 elements *)
AF332[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) (((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2)))];

(* Define total functions as array functions multitplied by element functions *)
(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
TF132[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) EF32broadside[x] EF32inplane[y]];


(* EW wires *)
TF232[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2))) EF32broadside[y] EF32inplane[x]];

(* Define Array Pattern for entire array of 8 elements *)
AP32[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) Sin[x(π/180)]])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyns π dyns f2m f)/c) Sin[y(π/180)]])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) Sin[y(π/180)]])^2))) EF32broadside[x] EF32inplane[y] (((Sin[((nxew π dxew f2m f)/c) Sin[x(π/180)]])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) Sin[x(π/180)]])^2))) (((Sin[((nyew π dyew f2m f)/c) Sin[y(π/180)]])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) Sin[y(π/180)]])^2))) EF32broadside[y] EF32inplane[x]];


(********************************************************************************************)
(*                                                                                          *)
(*  Main program code                                                                       *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

Plot3D[TF132[x,y],{x,-90,90},{y,-90,90},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
Ticks->{Table[i,{i,-60,90,30}],Table[i,{i,-90,90,30}],Table[i,{i,-20,0,5}]},
AxesLabel->{"Broadside (deg)","In Plane (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array Element Factor at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.783,-2.342,1.668}
]

Array Functions + Element Functions  with EW & NS Wires Convolved 24 MHz - Beam Steered to 20°S and 30°E
	Array functions for the EW and NW dipole groups multiplied by the appropriate element functions.

(********************************************************************************************)
(*                                                                                          *)
(*  Constants definitions section                                                           *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Speed of light in a vacuum *)
c=299792458;

(* Meters in one foot *)
f2m = 0.3048;

(* f = RF frequency being considered (Hertz) *)
f=24000000;

(* Beam steering in degrees from zenith *)
(* x axis = east-west direction (+)=E (-)=W *)
bsx=-30;
(* y axis = north-south direction (+)=N (-)=S *)
bsy=-10;

(* Parameters for North-South dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxns=32;
nxns=2;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyns=64;
nyns=2;

(* Parameters for East-West dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxew=32;
nxew=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyew=32;
nyew=4;


(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];

(* Define element factors *)
(* x = degrees off axis in noted direction *)
EF24broadside[x_]:=-4.921 10^-12 x^6+2.304 10^-9 x^5-2.656 10^-7 x^4+9.289 10^-6 x^3-1.775 10^-4 x^2+1.238 10^-3 x+0.9980/;0≤x≤90;
EF24broadside[x_]:=-4.921 10^-12 (-x)^6+2.304 10^-9 (-x)^5-2.656 10^-7 (-x)^4+9.289 10^-6 (-x)^3-1.775 10^-4 (-x)^2+1.238 10^-3 (-x)+0.9980/;-90≤x<0;
EF24inplane[x_]:=2.015 10^-11 x^6-4.473 10^-9 x^5+2.286 10^-7 x^4+1.214 10^-5 x^3-1.154 10^-3 x^2+2.270 10^-3 x+0.9958/;0≤x≤90;
EF24inplane[x_]:=2.015 10^-11 (-x)^6-4.473 10^-9 (-x)^5+2.286 10^-7 (-x)^4+1.214 10^-5 (-x)^3-1.154 10^-3 (-x)^2+2.270 10^-3 (-x)+0.9958/;-90≤x<0;

(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
AF124[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)))];


(* EW wires *)
AF224[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)))];

(* All 8 elements *)
AF324[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) (((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)))];

(* Define total functions as array functions multitplied by element functions *)
(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
TF124[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF24broadside[x] EF24inplane[y]];


(* EW wires *)
TF224[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF24broadside[y] EF24inplane[x]];

(* Define Array Pattern for entire array of 8 elements *)
AP24[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF24broadside[x] EF24inplane[y] (((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF24broadside[y] EF24inplane[x]];


(********************************************************************************************)
(*                                                                                          *)
(*  Main program code                                                                       *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)


ContourPlot[-Abs[TF224[x,y]-TF124[x,y]],{x,bsx-60,bsx+60},{y,bsy-60,bsy+60},
(*ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,bsx-30,bsx+30,5}],Table[i,{i,bsy-20,bsy+20,5}]},
GridLinesStyle->Thin,*)
Contours->Table[i,{i,-90,3,3}],
Axes->False,
AspectRatio->3/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array, Difference Between Yellow & Blue Dipoles","Steering: Zenith   3 dB Contours",ToString[f/1000000]<>" MHz"},Center],FontSize->24,Bold,FontFamily->Helvetica]
]






(* Plot aray function for NS wires*)
Plot3D[AF124[x,y],{x,-60,60},{y,-60,60},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["NS Wires Array Function at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.7748,-2.3687,1.6399}
]

(* Plot aray function for EW wires*)
Plot3D[AF224[x,y],{x,-60,60},{y,-60,60},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["EW Wires Array Function at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.7748,-2.3687,1.6399}
]

(* Plot aray function for 8 wires*)
Plot3D[AF324[x,y],{x,-60,60},{y,-60,60},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["Total Array Function at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.7748,-2.3687,1.6399}
]

(* Plot function for NS wires*)
Plot3D[TF124[x,y],{x,-60,60},{y,-60,60},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array NS Elements Pattern at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.7748,-2.3687,1.6399}
]

ContourPlot[TF124[x,y]==-3,{x,bsx-30,bsx+30},{y,bsy-20,bsy+20},
ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,bsx-30,bsx+30,5}],Table[i,{i,bsy-20,bsy+20,5}]},
GridLinesStyle->Thin,
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array NS Elements HPBW at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]]


(* Plot function for EW wires*)
Plot3D[TF224[x,y],{x,-60,60},{y,-60,60},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array EW Elements Pattern at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.7748,-2.3687,1.6399}
]

ContourPlot[TF224[x,y]==-3,{x,bsx-30,bsx+30},{y,bsy-20,bsy+20},
ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,bsx-30,bsx+30,5}],Table[i,{i,bsy-20,bsy+20,5}]},
GridLinesStyle->Thin,
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array EW Elements HPBW at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]]


(* Plot difference in gain between EW & NS wires*)
(* Gains in East-West direction *)
Plot[{TF124[x,0.001],TF224[x,0.001],TF124[x,0.001]-TF224[x,0.001]},{x,0.001,30},PlotRange->{-3,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-1,Red},-2,-3}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Difference (dB)",""},{"Off Axis E-W Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["Responses in East-West Direction",FontSize->24,Bold,FontFamily->Helvetica],
PlotLegends->Placed[{Style["N-S Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["E-W Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["Difference",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]
(* Gains in North-South direction *)
Plot[{TF124[0.001,x],TF224[0.001,x],TF224[0.001,x]-TF124[0.001,x]},{x,0.001,30},PlotRange->{-3,0},
PlotStyle->Thick,
GridLines->{{5,10,15,20,25,30},{{-1,Red},-2,-3}},
GridLinesStyle->Thick,
Axes->False,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Difference (dB)",""},{"Off Axis N-S Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["Responses in North-South Direction",FontSize->24,Bold,FontFamily->Helvetica],
PlotLegends->Placed[{Style["N-S Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["E-W Dipoles",FontSize->24,Bold,FontFamily->Helvetica],Style["Difference",FontSize->24,Bold,FontFamily->Helvetica]},Above]
]


(* Plot Array Pattern, all 8 elements *)
Plot3D[AP24[x,y],{x,-60,60},{y,-60,60},
Mesh->None,
PlotPoints->180,
PlotRange->{-20,0},
AxesLabel->{"EW (deg)","NS (deg)","Gain (dB)"},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array Pattern at Zenith at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica],
ViewPoint->{1.7748,-2.3687,1.6399}
]

ContourPlot[AP24[x,y]+5.27==-3,{x,bsx-30,bsx+30},{y,bsy-20,bsy+20},
ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,bsx-30,bsx+30,5}],Table[i,{i,bsy-20,bsy+20,5}]},
GridLinesStyle->Thin,
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array HPBW at Zenith ≈ 30° EW × 12° NS at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]
]

ContourPlot[-Abs[TF124[x,y]],{x,bsx-60,bsx+60},{y,bsy-60,bsy+60},
(*ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,bsx-30,bsx+30,5}],Table[i,{i,bsy-20,bsy+20,5}]},
GridLinesStyle->Thin,*)
Contours->Table[i,{i,-30,3,3}],
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array NS (blue) wires at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]
]
ContourPlot[-Abs[TF224[x,y]],{x,bsx-60,bsx+60},{y,bsy-60,bsy+60},
(*ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,bsx-30,bsx+30,5}],Table[i,{i,bsy-20,bsy+20,5}]},
GridLinesStyle->Thin,*)
Contours->Table[i,{i,-30,3,3}],
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style["TFD Array EW (yellow) wires at "<>ToString[f/1000000]<>" MHz",FontSize->24,Bold,FontFamily->Helvetica]
]



ContourPlot[-Abs[TF224[x,y]-TF124[x,y]],{x,bsx-60,bsx+60},{y,bsy-60,bsy+60},
(*ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,bsx-30,bsx+30,5}],Table[i,{i,bsy-20,bsy+20,5}]},
GridLinesStyle->Thin,*)
Contours->Table[i,{i,-90,3,3}],
Axes->False,
AspectRatio->3/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array, Difference Between Yellow & Blue Dipoles","Steering: Zenith   3 dB Contours",ToString[f/1000000]<>" MHz"},Center],FontSize->24,Bold,FontFamily->Helvetica]
]

ContourPlot[-Abs[AP24[x,y]],{x,bsx-60,bsx+60},{y,bsy-60,bsy+60},
(*ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,bsx-30,bsx+30,5}],Table[i,{i,bsy-20,bsy+20,5}]},
GridLinesStyle->Thin,*)
Contours->Table[i,{i,-90,3,3}],
Axes->False,
AspectRatio->3/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array HPBW at Zenith","Steering: Zenith   3 dB Contours",ToString[f/1000000]<>" MHz"},Center],FontSize->24,Bold,FontFamily->Helvetica]
]

ContourPlot[AP24[x,y]==-3,{x,-60,60},{y,-60,60},
ContourStyle->{Thick,Blue},
GridLines->{Table[i,{i,-60,60,10}],Table[i,{i,-60,60,10}]},
GridLinesStyle->Thin,
Axes->False,
AspectRatio->3/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array HPBW at Zenith","Steering: Zenith   3 dB Contours",ToString[f/1000000]<>" MHz"},Center],FontSize->24,Bold,FontFamily->Helvetica]
]

AP24[30.001,-20.001]

Array Functions + Element Functions  with EW & NS Wires Convolved 16 MHz - Beam Steered 2
	Array functions for the EW and NW dipole groups multiplied by the appropriate element functions.

(********************************************************************************************)
(*                                                                                          *)
(*  Constants definitions section                                                           *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Speed of light in a vacuum *)
c=299792458;

(* Meters in one foot *)
f2m = 0.3048;

(* f = RF frequency being considered (Hertz) *)
f=16000000;

(* Beam steering in degrees from zenith *)
(* x axis = east-west direction (-)=E (+)=W *)
bsx=30;
(* y axis = north-south direction (+)=N (-)=S *)
bsy=0;

(* Parameters for North-South dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxns=32;
nxns=2;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyns=64;
nyns=2;

(* Parameters for East-West dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxew=32;
nxew=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyew=32;
nyew=4;


(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];

(* Define element factors *)
(* x = degrees off axis in noted direction *)
EF16broadside[x_]:=-3.352 10^-12 x^6+1.279 10^-9 x^5-1.257 10^-7 x^4+4.216 10^-6 x^3-2.036 10^-4 x^2+6.240 10^-4 x+0.9995/;0≤x≤90;
EF16broadside[x_]:=-3.325 10^-12 (-x)^6+1.279 10^-9 (-x)^5-1.257 10^-7 (-x)^4+4.216 10^-6 (-x)^3-2.036 10^-4 (-x)^2+6.240 10^-4 (-x)+0.9995/;-90≤x<0;
EF16inplane[x_]:=1.975 10^-11 x^6-5.024 10^-9 x^5+3.838 10^-7 x^4-1.768 10^-6 x^3-7.095 10^-4 x^2+2.942 10^-4 x+0.99999/;0≤x≤90;
EF16inplane[x_]:=1.975 10^-11 (-x)^6-5.024 10^-9 (-x)^5+3.838 10^-7 (-x)^4-1.768 10^-6 (-x)^3-7.095 10^-4 (-x)^2+2.942 10^-4 (-x)+0.99999/;-90≤x<0;

(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
AF116[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)))];


(* EW wires *)
AF216[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)))];

(* All 8 elements *)
AF316[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) (((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)))];

(* Define total functions as array functions multitplied by element functions *)
(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
TF116[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF16broadside[x] EF16inplane[y]];


(* EW wires *)
TF216[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF16broadside[y] EF16inplane[x]];

(* Define Array Pattern for entire array of 8 elements *)
AP16[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF16broadside[x] EF16inplane[y] (((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF16broadside[y] EF16inplane[x]];


(********************************************************************************************)
(*                                                                                          *)
(*  Main program code                                                                       *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)


mv=MaxValue[AP16[x,y],{x,y}]

CP=ContourPlot[-Abs[TF216[x,y]-TF116[x,y]],{x,-60,60},{y,-40,40},
Contours->Table[i,{i,-21,0,1}],
Axes->False,
AspectRatio->2/3,
ColorFunction->"LakeColors",
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array Response     Difference Between EW & NS Dipoles","Beam Steering: NS "<>ToString[bsy]<>"° (S), EW "<>ToString[bsx]<>"° (W)",ToString[f/1000000]<>" MHz     1 dB Contours","Red = Jupiter Track 06 Jan 2014","Green = HPBW, Max Gain = "<>ToString[Round[mv*10.]/10.]<>" dB Relative"},Center],FontSize->24,Bold,FontFamily->Helvetica]
];


HP=ContourPlot[AP16[x,y]-mv==-3,{x,-60,60},{y,-40,40},
Contours->Table[i,{i,-21,0,1}],
ContourStyle->{Darker[Green],Thick},
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array Response     Difference Between EW & NS Dipoles","Beam Steering: NS "<>ToString[bsy]<>"° (S), EW "<>ToString[bsx]<>"° (W)",ToString[f/1000000]<>" MHz     1 dB Contours","Red = Jupiter Track 06 Jan 2014","Green = HPBW, Max Gain = "<>ToString[Round[mv*10.]/10.]<>" dB Relative"},Center],FontSize->24,Bold,FontFamily->Helvetica]
];

TrackData=Import["N:\\Documents\\0 RA\\Summer Meeting 2014\\Mine\\02-12 The DPS (Typinski)\\Source Docs\\Beam Steering Analysis\\20140106MMData.csv"];
(* TrackData[[All,2]]=-TrackData[[All,2]]; *)

LP=ListLinePlot[TrackData,
DataRange->{{0,60},{0,60}},
PlotRange->{{-60,60},{-40,40}},
PlotStyle->{Red,Thick},
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Steering North-South Direction (deg)",""},{"Steering East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array Response     Difference Between EW & NS Dipoles","Beam Steering: NS "<>ToString[bsy]<>"° (S), EW "<>ToString[bsx]<>"° (W)",ToString[f/1000000]<>" MHz     1 dB Contours","Red = Jupiter Track 06 Jan 2014","Green = HPBW, Max Gain = "<>ToString[Round[mv*10.]/10.]<>" dB Relative"},Center],FontSize->24,Bold,FontFamily->Helvetica]
];

Show[CP,HP,LP]

pk=Round2[FindMaxValue[TF224[x,y],{{x,bsx+1},{y,bsy+1}}] *10.]/10.
pkns=Round2[FindArgMax[{TF224[x,y],Abs[x]≤60,y<5},{x,y}]][[2]]
pkew=Round2[FindArgMax[{TF224[x,y],Abs[x]≤60,Abs[y]≤60},{x,y}]][[1]]

Array Functions + Element Functions  with EW & NS Wires Convolved 24 MHz - Beam Steered 2
	Array functions for the EW and NW dipole groups multiplied by the appropriate element functions.

(********************************************************************************************)
(*                                                                                          *)
(*  Constants definitions section                                                           *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Speed of light in a vacuum *)
c=299792458;

(* Meters in one foot *)
f2m = 0.3048;

(* f = RF frequency being considered (Hertz) *)
f=24000000;

(* Beam steering in degrees from zenith *)
(* x axis = east-west direction (-)=E (+)=W *)
bsx=30;
(* y axis = north-south direction (+)=N (-)=S *)
bsy=0;

(* Parameters for North-South dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxns=32;
nxns=2;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyns=64;
nyns=2;

(* Parameters for East-West dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxew=32;
nxew=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyew=32;
nyew=4;


(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];

(* Define element factors *)
(* x = degrees off axis in noted direction *)
EF24broadside[x_]:=-4.921 10^-12 x^6+2.304 10^-9 x^5-2.656 10^-7 x^4+9.289 10^-6 x^3-1.775 10^-4 x^2+1.238 10^-3 x+0.9980/;0≤x≤90;
EF24broadside[x_]:=-4.921 10^-12 (-x)^6+2.304 10^-9 (-x)^5-2.656 10^-7 (-x)^4+9.289 10^-6 (-x)^3-1.775 10^-4 (-x)^2+1.238 10^-3 (-x)+0.9980/;-90≤x<0;
EF24inplane[x_]:=2.015 10^-11 x^6-4.473 10^-9 x^5+2.286 10^-7 x^4+1.214 10^-5 x^3-1.154 10^-3 x^2+2.270 10^-3 x+0.9958/;0≤x≤90;
EF24inplane[x_]:=2.015 10^-11 (-x)^6-4.473 10^-9 (-x)^5+2.286 10^-7 (-x)^4+1.214 10^-5 (-x)^3-1.154 10^-3 (-x)^2+2.270 10^-3 (-x)+0.9958/;-90≤x<0;

(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
AF124[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)))];


(* EW wires *)
AF224[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)))];

(* All 8 elements *)
AF324[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) (((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)))];

(* Define total functions as array functions multitplied by element functions *)
(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
TF124[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF24broadside[x] EF24inplane[y]];


(* EW wires *)
TF224[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF24broadside[y] EF24inplane[x]];

(* Define Array Pattern for entire array of 8 elements *)
AP24[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF24broadside[x] EF24inplane[y] (((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF24broadside[y] EF24inplane[x]];


(********************************************************************************************)
(*                                                                                          *)
(*  Main program code                                                                       *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)


mv=MaxValue[AP24[x,y],{x,y}]

CP=ContourPlot[-Abs[TF224[x,y]-TF124[x,y]],{x,-60,60},{y,-40,40},
Contours->Table[i,{i,-21,0,1}],
Axes->False,
AspectRatio->2/3,
ColorFunction->"LakeColors",
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array Response     Difference Between EW & NS Dipoles","Beam Steering: NS "<>ToString[bsy]<>"° (S), EW "<>ToString[bsx]<>"° (W)",ToString[f/1000000]<>" MHz     1 dB Contours","Red = Jupiter Track 06 Jan 2014","Green = HPBW, Max Gain = "<>ToString[Round[mv*10.]/10.]<>" dB Relative"},Center],FontSize->24,Bold,FontFamily->Helvetica]
];


HP=ContourPlot[AP24[x,y]-mv==-3,{x,-60,60},{y,-40,40},
Contours->Table[i,{i,-21,0,1}],
ContourStyle->{Darker[Green],Thick},
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array Response     Difference Between EW & NS Dipoles","Beam Steering: NS "<>ToString[bsy]<>"° (S), EW "<>ToString[bsx]<>"° (W)",ToString[f/1000000]<>" MHz     1 dB Contours","Red = Jupiter Track 06 Jan 2014","Green = HPBW, Max Gain = "<>ToString[Round[mv*10.]/10.]<>" dB Relative"},Center],FontSize->24,Bold,FontFamily->Helvetica]
];

TrackData=Import["N:\\Documents\\0 RA\\Summer Meeting 2014\\Mine\\02-12 The DPS (Typinski)\\Source Docs\\Beam Steering Analysis\\20140106MMData.csv"];
TrackData2=Import["N:\\Documents\\0 RA\\Summer Meeting 2014\\Mine\\02-12 The DPS (Typinski)\\Source Docs\\Beam Steering Analysis\\20150120MMData.csv"];
(* TrackData[[All,2]]=-TrackData[[All,2]]; *)

LP=ListLinePlot[TrackData,
DataRange->{{0,60},{0,60}},
PlotRange->{{-60,60},{-40,40}},
PlotStyle->{Red,Thick},
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Steering North-South Direction (deg)",""},{"Steering East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array Response     Difference Between EW & NS Dipoles","Beam Steering: NS "<>ToString[bsy]<>"° (S), EW "<>ToString[bsx]<>"° (W)",ToString[f/1000000]<>" MHz     1 dB Contours","Red = Jupiter Track 06 Jan 2014","Green = HPBW, Max Gain = "<>ToString[Round[mv*10.]/10.]<>" dB Relative"},Center],FontSize->24,Bold,FontFamily->Helvetica]
];

LP2=ListLinePlot[TrackData2,
DataRange->{{0,60},{0,60}},
PlotRange->{{-60,60},{-40,40}},
PlotStyle->{Red,Thick},
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Steering North-South Direction (deg)",""},{"Steering East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array Response     Difference Between EW & NS Dipoles","Beam Steering: NS "<>ToString[bsy]<>"° (S), EW "<>ToString[bsx]<>"° (W)",ToString[f/1000000]<>" MHz     1 dB Contours","Red = Jupiter Track 20 Jan 2015","Green = HPBW, Max Gain = "<>ToString[Round[mv*10.]/10.]<>" dB Relative"},Center],FontSize->24,Bold,FontFamily->Helvetica]
];

Show[CP,HP,LP,LP2]

AP24[33,-9.95]

Array Functions + Element Functions  with EW & NS Wires Convolved 32 MHz - Beam Steered 2
	Array functions for the EW and NW dipole groups multiplied by the appropriate element functions.

(********************************************************************************************)
(*                                                                                          *)
(*  Constants definitions section                                                           *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Speed of light in a vacuum *)
c=299792458;

(* Meters in one foot *)
f2m = 0.3048;

(* f = RF frequency being considered (Hertz) *)
f=32000000;

(* Beam steering in degrees from zenith *)
(* x axis = east-west direction (-)=E (+)=W *)
bsx=30;
(* y axis = north-south direction (+)=N (-)=S *)
bsy=0;

(* Parameters for North-South dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxns=32;
nxns=2;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyns=64;
nyns=2;

(* Parameters for East-West dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxew=32;
nxew=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyew=32;
nyew=4;


(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];

(* Define element factors *)
(* x = degrees off axis in noted direction *)
EF32broadside[x_]:=-4.381 10^-13 x^6+2.532 10^-9 x^5-4.150 10^-7 x^4+1.779 10^-5 x^3-1.931 10^-4 x^2+2.815 10^-3 x+0.8642/;0≤x≤90;
EF32broadside[x_]:=-4.381 10^-13 (-x)^6+2.532 10^-9 (-x)^5-4.150 10^-7 (-x)^4+1.779 10^-5 (-x)^3-1.931 10^-4 (-x)^2+2.815 10^-3 (-x)+0.8642/;-90≤x<0;
EF32inplane[x_]:=9.248 10^-12 x^6+1.430 10^-10 x^5-4.655 10^-7 x^4+5.784 10^-5 x^3-2.362 10^-3 x^2+8.604 10^-3 x+0.9859/;0≤x≤90;
EF32inplane[x_]:=9.248 10^-12 (-x)^6+1.430 10^-10 (-x)^5-4.655 10^-7 (-x)^4+5.784 10^-5 (-x)^3-2.362 10^-3 (-x)^2+8.604 10^-3 (-x)+0.9859/;-90≤x<0;

(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
AF132[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)))];


(* EW wires *)
AF232[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)))];

(* All 8 elements *)
AF332[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) (((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)))];

(* Define total functions as array functions multitplied by element functions *)
(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
TF132[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF32broadside[x] EF32inplane[y]];


(* EW wires *)
TF232[x_,y_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF32broadside[y] EF32inplane[x]];

(* Define Array Pattern for entire array of 8 elements *)
AP32[x_,y_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF32broadside[x] EF32inplane[y] (((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF32broadside[y] EF32inplane[x]];


(********************************************************************************************)
(*                                                                                          *)
(*  Main program code                                                                       *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)


mv=MaxValue[AP32[x,y],{x,y}]
(*mv=-2.33*)

CP=ContourPlot[-Abs[TF232[x,y]-TF132[x,y]],{x,-60,60},{y,-40,40},
Contours->Table[i,{i,-21,0,1}],
Axes->False,
AspectRatio->2/3,
ColorFunction->"LakeColors",
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array Response     Difference Between EW & NS Dipoles","Beam Steering: NS "<>ToString[bsy]<>"° (S), EW "<>ToString[bsx]<>"° (W)",ToString[f/1000000]<>" MHz     1 dB Contours","Red = Jupiter Track 06 Jan 2014","Green = HPBW, Max Gain = "<>ToString[Round[mv*10.]/10.]<>" dB Relative"},Center],FontSize->24,Bold,FontFamily->Helvetica]
];


HP=ContourPlot[AP32[x,y]-mv==-3,{x,-60,60},{y,-40,40},
Contours->Table[i,{i,-21,0,1}],
ContourStyle->{Darker[Green],Thick},
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"North-South Direction (deg)",""},{"East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array Response     Difference Between EW & NS Dipoles","Beam Steering: NS "<>ToString[bsy]<>"° (S), EW "<>ToString[bsx]<>"° (W)",ToString[f/1000000]<>" MHz     1 dB Contours","Red = Jupiter Track 06 Jan 2014","Green = HPBW, Max Gain = "<>ToString[Round[mv*10.]/10.]<>" dB Relative"},Center],FontSize->24,Bold,FontFamily->Helvetica]
];

TrackData=Import["N:\\Documents\\0 RA\\Summer Meeting 2014\\Mine\\02-12 The DPS (Typinski)\\Source Docs\\Beam Steering Analysis\\20140106MMData.csv"];
(* TrackData[[All,2]]=-TrackData[[All,2]]; *)

LP=ListLinePlot[TrackData,
DataRange->{{0,60},{0,60}},
PlotRange->{{-60,60},{-40,40}},
PlotStyle->{Red,Thick},
Axes->False,
AspectRatio->2/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Steering North-South Direction (deg)",""},{"Steering East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array Response     Difference Between EW & NS Dipoles","Beam Steering: NS "<>ToString[bsy]<>"° (S), EW "<>ToString[bsx]<>"° (W)",ToString[f/1000000]<>" MHz     1 dB Contours","Red = Jupiter Track 06 Jan 2014","Green = HPBW, Max Gain = "<>ToString[Round[mv*10.]/10.]<>" dB Relative"},Center],FontSize->24,Bold,FontFamily->Helvetica]
];

Show[CP,HP,LP]

AP32[-20,-9.9]

Abs[TF232[20,.001]-TF132[20,.001]]

Array Functions + Element Functions  with EW & NS Wires Convolved 24 MHz - Beam Steered 3
	Array functions for the EW and NW dipole groups multiplied by the appropriate element functions.

(********************************************************************************************)
(*                                                                                          *)
(*  Constants definitions section                                                           *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Speed of light in a vacuum *)
c=299792458;

(* Meters in one foot *)
f2m = 0.3048;

(* f = RF frequency being considered (Hertz) *)
f=24000000;

(*
(* Beam steering in degrees from zenith *)
(* x axis = east-west direction (-)=E (+)=W *)
bsx=30;
(* y axis = north-south direction (+)=N (-)=S *)
bsy=-10;
*)

(* Parameters for North-South dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxns=32;
nxns=2;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyns=64;
nyns=2;

(* Parameters for East-West dipoles*)
(* x axis = east-west direction *)
(* dx = distance in feet between elements in x direction *)
(* nx = number of elements in the x direction *)
dxew=32;
nxew=1;
(* y axis = north-south direction *)
(* dy = distance in feet between elements in y direction *)
(* ny = number of elements in the y direction *)
dyew=32;
nyew=4;


(********************************************************************************************)
(*                                                                                          *)
(*  Function definitions section                                                            *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

(* Define proper rounding function as MM only rounds 0.5 up when the result is an even number *)
SetAttributes[Round2,Listable];
Round2[a_]:=If[FractionalPart[a]≥1/2,Ceiling[a],Floor[a]];

(* Define element factors *)
(* x = degrees off axis in noted direction *)
EF24broadside[x_]:=-4.921 10^-12 x^6+2.304 10^-9 x^5-2.656 10^-7 x^4+9.289 10^-6 x^3-1.775 10^-4 x^2+1.238 10^-3 x+0.9980/;0≤x≤90;
EF24broadside[x_]:=-4.921 10^-12 (-x)^6+2.304 10^-9 (-x)^5-2.656 10^-7 (-x)^4+9.289 10^-6 (-x)^3-1.775 10^-4 (-x)^2+1.238 10^-3 (-x)+0.9980/;-90≤x<0;
EF24inplane[x_]:=2.015 10^-11 x^6-4.473 10^-9 x^5+2.286 10^-7 x^4+1.214 10^-5 x^3-1.154 10^-3 x^2+2.270 10^-3 x+0.9958/;0≤x≤90;
EF24inplane[x_]:=2.015 10^-11 (-x)^6-4.473 10^-9 (-x)^5+2.286 10^-7 (-x)^4+1.214 10^-5 (-x)^3-1.154 10^-3 (-x)^2+2.270 10^-3 (-x)+0.9958/;-90≤x<0;

(* Define total functions as array functions multitplied by element functions *)
(* Define array function, output is in terms of dB down relative to beam centerline *)
(* x = degrees off axis in east-west direction *)
(* y = degrees off axis in north-south direction *)

(* NS wires *)
TF124[x_,y_,bsx_,bsy_]:=10 Log10[(((Sin[((nxns π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxns^2) ((Sin[((π dxns f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyns π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyns^2) ((Sin[((π dyns f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF24broadside[x] EF24inplane[y]];


(* EW wires *)
TF224[x_,y_,bsx_,bsy_]:=10 Log10[(((Sin[((nxew π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2)/((nxew^2) ((Sin[((π dxew f2m f)/c) (Sin[x(π/180)]-Sin[bsx(π/180)])])^2))) (((Sin[((nyew π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2)/((nyew^2) ((Sin[((π dyew f2m f)/c) (Sin[y(π/180)]-Sin[bsy(π/180)])])^2))) EF24broadside[y] EF24inplane[x]];


(********************************************************************************************)
(*                                                                                          *)
(*  Main program code                                                                       *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)


Gains=Table[{i,0,5,10,15,20,25,30,35,40,45,50,55,60},{i,-5,60,5}];
Do[
Do[
Gains[[i/5+2,j/5+2]]=Abs[TF224[i+0.001,j+0.001,i,j]-TF124[i+0.001,j+0.001,i,j]]
,{j,0,60,5}]
,{i,0,60,5}];
Gains[[1,1]]="     NSv | EW>";
(*
Export["N:\\Documents\\0 RA\\Summer Meeting 2014\\Mine\\02-12 The DPS (Typinski)\\Source Docs\\Beam Steering Analysis\\24 MHz BY Differences by Beam Steering Position.csv",Gains,"CSV"];
*)

CP=ListContourPlot[-Gains[[2;;14,2;;14]],
Contours->Table[i,{i,-21,0,1}],
DataRange->{{0,60},{0,60}},
Axes->False,
AspectRatio->3/3,
ColorFunction->"LakeColors",
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Steering North-South Direction (deg)",""},{"Steering East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array Response","Difference Between EW & NS Dipoles versus","Beam Steering Direction (Assumes On-Axis Source)",ToString[f/1000000]<>" MHz     1 dB Contours","Red = Jupiter Track 20 Jan 2015"},Center],FontSize->24,Bold,FontFamily->Helvetica]
];

TrackData=Import["N:\\Documents\\0 RA\\Summer Meeting 2014\\Mine\\02-12 The DPS (Typinski)\\Source Docs\\Beam Steering Analysis\\20150120MMData.csv"];
TrackData[[All,2]]=-TrackData[[All,2]];

LP=ListLinePlot[TrackData,
DataRange->{{0,60},{0,60}},
PlotRange->{{0,60},{0,60}},
PlotStyle->{Red,Thick},
Axes->False,
AspectRatio->3/3,
Frame->True,
FrameStyle->Thick,
FrameLabel->{{"Steering North-South Direction (deg)",""},{"Steering East-West Direction (deg)",""}},
LabelStyle->Directive[Bold,FontFamily->Helvetica,24],
PlotLabel->Style[Column[{"TFD Array Response","Difference Between EW & NS Dipoles versus","Beam Steering Direction (Assumes On-Axis Source)",ToString[f/1000000]<>" MHz     1 dB Contours","Red = Jupiter Track 20 Jan 2015"},Center],FontSize->24,Bold,FontFamily->Helvetica]
];

Show[CP,LP]