closeall; clear; E = getresult('field','E'); Ex = E.Ex; Ey = E.Ey; z = E.z; # track the TE fraction in side the rotator TE_frac = matrix(length(z)); for (i=1:length(z)){ Ex_slice = pinch(Ex,3,i); Ey_slice = pinch(Ey,3,i); TE_frac(i) = abs(Ex_slice)^2/(abs(Ex_slice)^2+abs(Ey_slice)^2); } # plot results plot(z*1e6,TE_frac,'z (um)','TE Fraction');