run; m="far_field_change_index"; n_air=1; # standard far field projection, assuming the substrate extends to infinity ux=farfieldux(m+"::field",1,201,201); uy=farfielduy(m+"::field",1,201,201); E2_A = farfield3d(m+"::field",1,201,201); # far field projection in a medium with index=1, using the plane wave expansion method. # Note: The plane wave exansion method does not give the field amplitude (or power) values # that would be measured experimentally! ux=farfieldux(m+"::field",1,201,201); uy=farfielduy(m+"::field",1,201,201); E2_B = farfield3d(m+"::field",1,201,201,1,1,1,n_air); # far field projection in a medium with index=1, using the Fresnel corection # method, as implemented in teh Far field change index analysis group; E2_C = getresult(m,"E2_far"); image(ux,uy,E2_A,"","","Standard projection, n_far=2","plot polar"); image(ux,uy,E2_B,"","","Plane wave expansion, n_far=1","plot polar"); image(E2_C.ux,E2_C.uy,E2_C.E2_far2,"","","Fresnel correction, n_far=1","plot polar"); plot(ux,pinch(E2_A,2,101),pinch(E2_B,2,101),pinch(E2_C.E2_far2,2,101),"ux","|E|^2|","Far field"); legend("Standard projection, n_far=2","Plane wave expansion, n_far=1","Fresnel correction, n_far=1");