Guilin Sun
Ansys Employee
Hi, I think this question appears in different posts. However I do not know what quantity you have at hand in script. In general, you can get the the intensity by use of
E2=getelectric("monitor")
This is in general a 4D matrix: x,y,z, and f, even some of them has only one element, eg, for a 3D simulation, a 2D DFT monitor perpendicular to z axis, E2 would have (please pick up x,y,z, and f from the monitor using script)
nx=length(x)
ny=length(y)
nz=length(z), which is 1
and
nf=length(f).
In order to plot the graph shown above, you will need to find the y value. For example, at y=0, you can use
E2_x=pinch(E2(:,find(y,0),1,2)) This script picks up the 2nd frequency point (4th dimension), and y=0 plane.
Then you can plot
plot(x*1e6, E2_x,"x um","E2");
You can also plot the normalized result with max=1:
plot(x*1e6, E2_x/max(E2_x),"x um","E2");
Please refer the script introduction website and related edu videos for more information.