I'm trying to use a list of data points from a csv file to perform multiple calculations and plot the end result. Basically I have 3 columns of data in my csv, I need the second and third to be pulled in as N1 and N2, and then the first column (wavelength) needs to be the list of x values I am plotting against. I'm completely lost with how to make this loop work.
lines = 100; \[Theta]t = Table[i, {i, lines}]; wavelength =
Table[i, {i, lines}];
N1 = Table[i, {i, lines}]; N2 = Table[i, {i, lines}]; k1 =
Table[i, {i, lines}]; k2 = Table[i, {i, lines}];
rs = Table[i, {i, lines}]; rp = Table[i, {i, lines}]; Rs =
Table[i, {i, lines}]; Rp = Table[i, {i, lines}]; n1 =
Table[i, {i, lines}]; n2 = Table[i, {i, lines}];
degrees = 45;
\[Theta]i = degrees*Pi/180;
Ravg0 = Table[i, {{i, lines} {j, 2}}];
z = 1;
While[z < (lines),
wavelength[[z]] = s[[z, 1]];
N2[[z]] = s[[z, 2]];
k2[[z]] = s[[z, 3]];
n1[[z]] = 1 + k1[[z]]*I;
n2[[z]] = N2[[z]] + k2[[z]]*I;
\[Theta]t[[z]] = ArcSin[(Sin[\[Theta]i]*(n1[[z]]/n2[[z]]))];
rs[[z]] = -Sin[\[Theta]i - \[Theta]t[[z]]]/
Sin[\[Theta]i + \[Theta]t[[z]]];
rp[[z]] =
Tan[\[Theta]i - \[Theta]t[[z]]/Tan[\[Theta]i + \[Theta]t[[z]]];
Rs[[z]] = rs[[z]]*SuperStar[rs[[z]]];
Rp[[z]] = rp[[z]]*SuperStar[rp[[z]]];
Ravg0[[z, 2]] = (Rs[[z]] + Rp[[z]])/2;
Ravg0[[z, 1]] = wavelength[[z]];
z++]];
ListPlot[Ravg0, PlotRange -> All, Joined -> True]
Some of the errors I am recieving:
Set::partd: Part specification Ravg0[[z,2]] is longer than depth of object.
Set::partd: Part specification Ravg0[[z,1]] is longer than depth of object.
Set::partd: Part specification Ravg0[[z,2]] is longer than depth of object.
General::stop: Further output of Set::partd will be suppressed during this calculation.
Set::partw: Part 3 of {i,i} does not exist.
Set::partw: Part 3 of {i,i} does not exist.
Set::partw: Part 4 of {i,i} does not exist.
Again, I'm completely lost as to what any of this means, and I know very little about mathematica, so any help would be appreciated.



