Hi @ghazi.syed

Your simulation file has a few issue:

- Under the
*For Sweep* structure group, you need to modify your script so that it changes the thickness i.e. the z-values. Currently it modifies the y span.
- Sweep object has to have a proper start and stop.

Please visit the link below for a similar application example:

https://kb.lumerical.com/en/index.html?sweeps_nested_sweeps.html

Regarding your script:

since the substrate extends through PML, you need to have only three layers. Also, you do not need to sweep over different angles if that’s not what you want. Here is a modified simulation file:

```
f = linspace(c/400e-9, c/1000e-9,100); # frequency vector
theta = 0;#:1:45; # angle vector
v = [10e-9;20e-9;30e-9];
t = [1;2;3]; #[0;10e-9; 50e-9;0]; # 4 layers (including air on top, bottom)
#n1 = [1; 1.5; 2.5; 1.5; 1]; # refractive index of each layer (non-dispersive)
# get RT using non-dispersive index data, and theta=0
#RT1 = stackrt(n1,d,f);
#field1 = stackfield(n1,d,f);
# alternate refractive index vector, for dispersive materials
nf = length(f);
nd = length(t);
n2 = matrix(nd,nf);
n2(1,1:nf) = 1; # air
n2(2,1:nf) = getfdtdindex("A",f,min(f),max(f));
n2(3,1:nf) = getfdtdindex("Pt (Platinum) - Palik",f,min(f),max(f));
#n2(4,1:nf) = getfdtdindex("SiO2 (Glass) - Palik",f,min(f),max(f));
#n2(4,1:nf) = 1; # air
# get RT using dispersive data (n2), and theta from 0 to 45 deg
for (i=1:3){
d = [0;v(i);50e-9];
eval("RT"+num2str(i)+"= stackrt(n2,d,f,theta);");
field2 = stackfield(n2,d,f,theta);
}
```

Hope this was helpful.