Returns the relative strength of all physical grating orders where vector field information is returned in spherical coordinates. This is useful when studying the polarization effects. The data is normalized such that the sum of Er^2+Etheta^2+ Ephi^2 over all grating orders equals 1. See the grating function documentation for information on interpreting N, M, ux, uy for various monitor orientations.
3D simulations: Data is returned in a NxMxPx3 matrix where N,M are the number of grating orders. P is the number of frequency points. The third dimension is Er, Etheta, Ephi.
2D simulations: Data is returned in a NxPx3 matrix where N is the number of grating orders. P is the number of frequency points. The second dimension is Er, Etheta, Ephi.
The results are returned on hemisphere 1m away. For more information on the basis used please refer to Understanding field polarization in far field projections
Syntax 
Description 

out = gratingpolar( "mname", f, index, direction); 
Returns the strength of all physical grating orders from the monitor. Output is in spherical coordinates. 
Parameter 
Default value 
Type 
Description 


mname 
required 
string 
name of the monitor from which far field is calculated 

f 
optional 
1 
vector 
Index of the desired frequency point. This can be a single number of a vector. 
index 
optional 
value at monitor center 
number 
The index of the material to use for the projection. 
direction 
optional 
direction of max power flow 
number 
Direction: this can be +1 or 1. 
Examples
This 2D result shows that gratingpolar gives the same result as the grating function when we calculate Er^2+Etheta^2+ Ephi^2.
?Gp=gratingpolar("monitor1"); result: 3.06956e017+0i 0.0697040.32201i 0+0i 3.66784e0181.46714e017i 0.08131860.381864i 0+0i 2.97089e017+1.48545e017i 0.6701190.442682i 0+0i 4.78864e0183.83091e017i 0.05858440.30093i 0+0i ?sum(abs(Gp)^2,2); result: 0.108549 0.152433 0.645027 0.093991 ?G=grating("monitor1"); result: 0.108549 0.152433 0.645027 0.093991
See Also
List of commands , grating , gratingn , gratingperiod1 , gratingbloch1 , gratingu1 , gratingangle , gratingvector , Far field projections  Field polarization