##################################################################
# angled_injection.lsf
#
# This script plots the results between the reflection from a
# surface as measured by a monitor in front of a broadband angled
# source with center injection angle of 30 degrees, and compares
# the results to theoretical results.
##################################################################
# run simulation
run;
# get simulation data from monitors
R=getresult("R","T");
T=getresult("T","T");
f=R.f;
# transmission through monitor behind source
R1 = -R.T;
# reflection calculated from monitor in front of source
R2 = 1 - T.T;
# Calculate theory with stackRT function
R3=R2*0;
for (i=1:length(f)) {
theta1=getsourceangle("source",f(i)); # actual source angle
RT = stackrt([1;2],[0;0],f(i),theta1);
R3(i) = RT.Rp;
}
# Plot results from two methods versus theory
plot(c/f*1e6,R1,R2,R3,"wavelength (um)","transmission");
legend("Monitor behind source","Monitor in front of source","Theory");