Ansys Learning Forum Forums Discuss Simulation Photonics Lumerical help, dielectric slab waveguide Reply To: Lumerical help, dielectric slab waveguide

Marton Ambrus
Subscriber

 

I managed to figure out how to change the indexes of each layer within the script, this is how I changed the script you gave me:

deleteall;
x_span = 4e-06;
z_span = 7e-06;
mid_thickness = 3e-06;
d = [Cladding1,Core1,Cladding2,Core2,Cladding3];
cladding_index=1.455067;
core_index=2.682648;
y = matrix(length(d),1);
y(1) = 0e-06;
addrect;
set("x span",x_span);
set("z span",z_span);
set("y",y(1));
set("y span",d(1));
set("name","layer_"+num2str(1));
select("layer_1");
set("index", cladding_index);
for (i = 2:1:length(d)){
addrect;
y(i) = y(i-1)+(d(i-1)+d(i))/2;
set("x span",x_span);
set("z span",z_span);
set("y",y(i));
set("y span",d(i));
set("name","layer_"+num2str(i));
}
select("layer_"+num2str(2));
set("index",core_index);
select("layer_"+num2str(4));
set("index",core_index);
select("layer_"+num2str(3));
set("index",cladding_index);
select("layer_"+num2str(5));
set("index",cladding_index);