 ## Photonics

• Catherine.antipuesto
Subscriber

Hi! I am new to Lumerical and I would just like to ask how to obtain the wavelength vs phase graph. Thank you! :)

• Guilin Sun
Ansys Employee

There are 2 steps using script to get the phase:
1: get the field components. As you know, the phase is associated with Ex,Ey, Ez (or H components). So you can use
E=getresult("monitor","E");
Ex=E.Ex;
Ey=E.Ey;
Ez=E.Ez;
similarly you can get x,y,z and f.
2: get the phase. for example for Ex, you can write
xphase=angle(Ex);
which will be a function of xyz and f.

• Guilin Sun
Ansys Employee

1: you can use Ex=getdata("monitor","EX") if you know you want Ex
2: you can use pinch to remove singular dimension: https://optics.ansys.com/hc/en-us/articles/360034405674-pinch-Script-command

• Catherine.antipuesto
Subscriber

Thank you for this! How can I plot this? Thank you!

• Guilin Sun
Ansys Employee

plot is only for 1D data. eg, plot(x,y,”x”,”y”,”y(x)”.

image is for 2D data.

please search plot/image in Lumerical website  https://optics.ansys.com/hc/en-us/articles/360034410474-plot-Script-command

depending on the dimension of phase, please choose proper script to plot it.

• Catherine.antipuesto
Subscriber

Hello! I tried plotting it with the script:

E=getresult("through","E");
Ex=pinch(E.Ex);
Ey=pinch(E.Ey);
Ez=pinch(E.Ez);
xphase=angle(Ex);
f = getdata("through","f");
plot(c/f,xphase);

However, it says:
Error:
line 7: y matrix must be same length as x matrix

How do I fix this?

Why is my E-field matrix [69, 500]? What does this mean?

Thank you so much!

` `
• Guilin Sun
Ansys Employee

This question has been replied in another post. 