library(planar)
d <- 1
lambda <- 632.8 + c(0, 10, 20)
nPrism = 1.5
nWater = 1.3
metal <- epsAu(lambda)
polarisation <- "p"
thickness <- 20
theta <- seq(-89, 89, length = 1000) * pi/180
M <- multilayer(lambda = lambda, theta = theta, polarisation = polarisation,
thickness = c(0, thickness, 0), d = 1, epsilon = list(nPrism^2, metal$epsilon,
nWater^2))
names(M)
## [1] "k0" "q" "reflection" "transmission"
## [5] "R" "T" "dist" "fields"
## [9] "Ml.perp" "Ml.par" "Mr.perp" "Mr.par"
str(M)
## List of 12
## $ k0 : num [1:3] 0.00993 0.00977 0.00962
## $ q : num [1:1000] -1 -1 -1 -1 -1 ...
## $ reflection : cplx [1:3, 1:1000] -0.992-0.014i -0.993-0.01i -0.993-0.006i ...
## $ transmission: cplx [1:3, 1:1000] 0.0039-0.0751i 0.0033-0.0731i 0.0028-0.0714i ...
## $ R : num [1:3, 1:1000] 0.984 0.986 0.987 0.982 0.983 ...
## $ T : num [1:3, 1:1000] 0.00566 0.00536 0.0051 0.00785 0.00744 ...
## $ dist :List of 3
## ..$ : num -1
## ..$ : num 1
## ..$ : num 21
## $ fields :List of 4
## ..$ Eix.E1 : cplx [1:3, 1:1000, 1:3] 0.0175-0i 0.0175-0i 0.0175-0i ...
## ..$ Epix.E1: cplx [1:3, 1:1000, 1:3] 0.0173+0.0002i 0.0173+0.0002i 0.0173+0.0001i ...
## ..$ Eiz.E1 : cplx [1:3, 1:1000, 1:3] 1-0i 1-0i 1-0i ...
## ..$ Epiz.E1: cplx [1:3, 1:1000, 1:3] -0.992-0.014i -0.993-0.01i -0.993-0.006i ...
## $ Ml.perp :List of 2
## ..$ : num [1:3, 1:1000] 2.67e-04 1.62e-04 9.29e-05 3.71e-04 2.26e-04 ...
## ..$ : num [1:3, 1:1000] 0.000197 0.000164 0.000139 0.000273 0.000228 ...
## $ Ml.par :List of 2
## ..$ : num [1:3, 1:1000] 0.00121 0.00121 0.00121 0.00168 0.00168 ...
## ..$ : num [1:3, 1:1000] 0.00236 0.00224 0.00214 0.00328 0.00311 ...
## $ Mr.perp :List of 2
## ..$ : num [1:3, 1:1000] 1.26e-05 7.21e-06 3.90e-06 1.76e-05 1.00e-05 ...
## ..$ : num [1:3, 1:1000] 0.00988 0.00936 0.00891 0.0137 0.01298 ...
## $ Mr.par :List of 2
## ..$ : num [1:3, 1:1000] 0.00123 0.00122 0.00122 0.0017 0.0017 ...
## ..$ : num [1:3, 1:1000] 0.00246 0.00233 0.00221 0.00341 0.00323 ...
par(mfrow = c(2, 1), mar = c(3, 3, 1.1, 0.1), mgp = c(2, 1, 0))
# first plot, step by step
plot(theta * 180/pi, M$Mr.par[[1]][1, ], type = "l", xlab = "angle",
ylab = "M")
lines(theta * 180/pi, M$Mr.perp[[1]][2, ], col = 2, lty = 2)
# second plot, several columns at once
with(M, matplot(q, t(R[1:3, ]), t = "l", lty = 1))