Adding together vertical and horizontal polarizations, by Levi Homer, Jun 2024

Clear["`*"]
SetDirectory[NotebookDirectory[]]

Simple 2D Vector Sum

(* Magnitude of vertical and horizontal polarizations *)
verticalMag=1;
horizontalMag= 1;
(* Phase difference in degrees (90 deg -> quarter wave, 180 deg -> half wave, etc.) *)
ϕ=90 Degree ;

(* You don't need to adjust any of this *)
vertical[θ_]={verticalMag,0}Cos[θ];
horizontal[θ_]={0,horizontalMag}Cos[θ+ϕ];
sum[θ_]=vertical[θ]+horizontal[θ];

Animate[Graphics[{Thick,Arrow[{{0,0},sum[θ]}],Blue,Thick,Arrow[{{0,0},vertical[θ]}],Red,Thick,Arrow[{{0,0},horizontal[θ]}]},AspectRatio->1,Axes->True,PlotRange->{{-1.2,1.2},{-1.2,1.2}}],{θ,0,2π},AnimationDirection->Forward]

3D Propagation

(* Ratio of vertical and horizontal polarizations (as in, vertical magnitude/horizontal magnitude) *)
AR=1;

(* Phase difference in degrees (90 deg -> quarter wave, 180 deg -> half wave, etc.) *)
ϕ=90 Degree;

(* How far do you want to see it propagate? 40 usually Looks good. *)
propRange=40; 

(* You don't need to adjust any of this *)
verticalMag=4*AR;
horizontalMag=4;
maxMag=Sqrt[verticalMag^2+horizontalMag^2];
vertical[x_,t_]={0,0,verticalMag}Cos[x-t]; (*x,y,z*)
horizontal[x_,t_]={0,horizontalMag,0}Cos[x-t+ϕ]; (* propgating in x direction*)
sum[x_,t_]=vertical[x,t]+horizontal[x,t];

(* Preview the animation *)
Animate[
	Show[
		Graphics3D[{Arrowheads[0.015],
			Black,Arrow[Tube[{{0,0,0},sum[0,t]}]],Arrow[Tube[{{propRange,0,0},sum[propRange,t]+{propRange,0,0}}]],(* Sum vector *)
			Blue,Arrow[Tube[{{0,0,0},vertical[0,t]}]],Blue,Arrow[Tube[{{propRange,0,0},vertical[propRange,t]+{propRange,0,0}}]], (* Vertical vector *)
			Red,Arrow[Tube[{{0,0,0},horizontal[0,t]}]],Red,Arrow[Tube[{{propRange,0,0},horizontal[propRange,t]+{propRange,0,0}}]](* Horizontal vector *)
			},
			Axes->False,Ticks->None,Boxed->False,AxesOrigin->{0,0,0},
			FaceGrids->{{{1,0,0},{{0,maxMag,-maxMag},{0,maxMag,-maxMag}}},
					{{-1,0,0},{{0,maxMag,-maxMag},{0,maxMag,-maxMag}}},
					{{0,1,0},{None,{-maxMag,maxMag}}},
					{{0,0,-1},{None,{-maxMag}}}
		},
			ImageSize->800,PlotRange->{{0,propRange},{-maxMag,maxMag},{-maxMag,maxMag}}
		],
		ParametricPlot3D[{x,horizontalMag*Cos[x-t+ϕ],verticalMag*Cos[x-t]},{x,0,propRange},PlotStyle->{Black,Thickness[0.003]}],(* Sum propagation*)
		ParametricPlot3D[{x,0,verticalMag*Cos[x-t]},{x,0,propRange},PlotStyle->{Blue,Thickness[0.002]}], (* Vertical propagation *)
		ParametricPlot3D[{x,horizontalMag*Cos[x-t+ϕ],0},{x,0,propRange},PlotStyle->{Red,Thickness[0.002]}](* Horizontal propagation *)
	],
{t,0,2π},AnimationDirection->Forward,AnimationRunning->False]

(* Export the Animation *)

(* Select desired filename *)
filename="Test.gif"

(* You don't need to adjust any of this *)
anim=Table[Show[
		Graphics3D[{Arrowheads[0.015],
			Black,Arrow[Tube[{{0,0,0},sum[0,t]}]],Arrow[Tube[{{propRange,0,0},sum[propRange,t]+{propRange,0,0}}]],(* Sum vector *)
			Blue,Arrow[Tube[{{0,0,0},vertical[0,t]}]],Blue,Arrow[Tube[{{propRange,0,0},vertical[propRange,t]+{propRange,0,0}}]], (* Vertical vector *)
			Red,Arrow[Tube[{{0,0,0},horizontal[0,t]}]],Red,Arrow[Tube[{{propRange,0,0},horizontal[propRange,t]+{propRange,0,0}}]](* Horizontal vector *)
			},
			Axes->False,Ticks->None,Boxed->False,AxesOrigin->{0,0,0},
			FaceGrids->{{{1,0,0},{{0,maxMag,-maxMag},{0,maxMag,-maxMag}}},
					{{-1,0,0},{{0,maxMag,-maxMag},{0,maxMag,-maxMag}}},
					{{0,1,0},{None,{-maxMag,maxMag}}},
					{{0,0,-1},{None,{-maxMag}}}
		},
			ImageSize->800,PlotRange->{{0,propRange},{-maxMag,maxMag},{-maxMag,maxMag}}
		],
		ParametricPlot3D[{x,horizontalMag*Cos[x-t+ϕ],verticalMag*Cos[x-t]},{x,0,propRange},PlotStyle->{Black,Thickness[0.003]}],(* Sum propagation*)
		ParametricPlot3D[{x,0,verticalMag*Cos[x-t]},{x,0,propRange},PlotStyle->{Blue,Thickness[0.002]}], (* Vertical propagation *)
		ParametricPlot3D[{x,horizontalMag*Cos[x-t+ϕ],0},{x,0,propRange},PlotStyle->{Red,Thickness[0.002]}] (* Horizontal propagation *)
	],{t,0,2π,0.1}];
Export[filename,anim];