Problem 44070. Under the sea: Snell's law & total internal reflection

https://en.wikipedia.org/wiki/Snell's_law

When a light travels from one medium to another medium, depending on the refractive index, the light will bend with a certain angle. For certain combination of materials, it might be that light cannot escape one medium at all from a certain angle (greater than critical angle). It is called total internal reflection. If you point a flashlight from "under the sea" the light won't leave the water at all.

For given refractive indices, find critical angle where total internal reflection happens. If total internal reflection does not happen for any angle, then return "-1".

Example1: n_in = 1.333, n_out = 1, theta_crit = 48.6 degrees; Example2: n_out = 1, n_in = 1.333, theta_crit = -1 (total internal reflection does not occur, if you are in the air, and beaming light at the water.)

Input of function: n_in, n_out (refractive index, positive) Output: critical angle (rounded to nearest integer), if total internal reflection occurs. Else return -1.

Solution Stats

41.26% Correct | 58.74% Incorrect
Last Solution submitted on Mar 31, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers51

Suggested Problems

More from this Author9

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!