diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-07-07 21:49:36 -0400 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-07-07 21:49:36 -0400 |
commit | 7029af4187e83db0aff57fccf1b8ef61fadab268 (patch) | |
tree | 495d3e4cade512cf29c846cd2d5bf77960bfe9d2 | |
parent | 789728cddc88718d500127cd30076ab4017a6934 (diff) | |
download | wgmr-7029af4187e83db0aff57fccf1b8ef61fadab268.tar.gz wgmr-7029af4187e83db0aff57fccf1b8ef61fadab268.zip |
reflection coefficient according to Fresnel equation
-rw-r--r-- | fresnel_reflection.m | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/fresnel_reflection.m b/fresnel_reflection.m new file mode 100644 index 0000000..db3b637 --- /dev/null +++ b/fresnel_reflection.m @@ -0,0 +1,26 @@ +function [R, theta_t] = fresnel_reflection(n1, n2, theta_i) +%% calculates intensity reflection coefficient for s and p polarizations +%% for light travelling from material with index of refraction n1 to material with n2 +%% theta_i - incident index of refraction +%% R - coefficients of reflection array [Rs, Rp] + + %% see http://en.wikipedia.org/wiki/Fresnel_equations + %% refracstion angle or angle of transmitted beam with respect to normal + sin_theta_t=n1/n2*sin(theta_i); + + if ( abs(sin_theta_t) >= 1) + %% total internal reflection + R = [1, 1]; + theta_t=sign(theta_i)*pi/2; + return; + end + + theta_t = asin(sin_theta_t); % angle of refraction or transmitted beam + + cos_theta_t = cos( theta_t ); + cos_theta_i = cos( theta_i ); + + Rs = ( ( n1*cos_theta_i - n2*cos_theta_t ) / ( n1*cos_theta_i + n2*cos_theta_t ) ).^2; + Rp = ( ( n1*cos_theta_t - n2*cos_theta_i ) / ( n1*cos_theta_t + n2*cos_theta_i ) ).^2; + R = [Rs,Rp]; +end |