Last active
September 1, 2019 02:38
-
-
Save lnacquaroli/8159fdfb38692a4d76e1f20912a28df6 to your computer and use it in GitHub Desktop.
Computes the reflection of a sequence n of refractive indexes wihtout interference and absorption effects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Computes the reflection of a sequence of indices of refraction without interference and absorption effects. | |
y = multipleReflections(n) | |
author: Cuchu & lnacquaroli | |
""" | |
function multipleReflections(n::Array{Real}) | |
R1::Float64 = 0.0 | |
R::Float64 = 0.0 | |
for i = 1:length(n)-1 | |
R2 = ( (n[i] - n[i+1])/(n[i] + n[i+1]))^2 | |
R = (R1 + R2 - 2.0*R1*R2)/(1.0 - R1*R2) | |
R1 = R | |
end | |
return R | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment