Ansys Learning Forum › Forums › Discuss Simulation › Photonics › How to calculate modal overlap coefficient during the second harmonic generation › Reply To: How to calculate modal overlap coefficient during the second harmonic generation

Hello, Dear Amrita Pati!

After running the script and checking the matrix size,it shows that E11 is not a matrix typeï¼š

I realized it could be a numerical value.But isn't it defined in the formula as the square of the electric intensity? So I changed the formula to the following:

E111=(abs(Ex1))^2+(abs(Ey1))^2+(abs(Ez1))^2;

E211=(abs(Ex2))^2+(abs(Ey2))^2+(abs(Ez2))^2;

E1=sqrt((abs(Ex1))^2+(abs(Ey1))^2+(abs(Ez1))^2);

E2=sqrt((abs(Ex2))^2+(abs(Ey2))^2+(abs(Ez2))^2);

norm1 = integrate( E111*E1,1:2,x_new,y_new );

norm2 = integrate( E211*E2,1:2,x_new,y_new );

tempA = integrate( (conj( Ez1_temp))^2*Ez2_temp,[1,3],x_new,y_new );