############################################################# # scriptfile: dipole_4layer.lsf # # This file calculates the reflection spectrum for # a triple dielectric interface. It does both polarizations # (TE and TM) and compares to the analytic result. # # Copyright 2010, Lumerical Solutions, Inc. ############################################################# sweepname = "4layer"; # run the sweep, or comment to use previously run data #runsweep; f = getsweepdata(sweepname,"f"); theta = getsweepdata(sweepname,"theta"); n = getsweepdata(sweepname,"n"); d = getsweepdata(sweepname,"d"); Rs_fdtd = pinch(getsweepdata(sweepname,"r"),2,1); Rp_fdtd = pinch(getsweepdata(sweepname,"r"),2,2); # calculate the analytic response of the system # call stack_r_t to calculate theoretical values RT_Theory = stackrt(n,d,f,theta); # compare to theoretical values plot(theta,Rs_fdtd,RT_Theory.Rs,Rp_fdtd,RT_Theory.Rp,"angle (degrees)","Reflection","Reflection vs angle"); legend("S FDTD","S Theory","P FDTD","P Theory");