Question
When a ray of light passes from a region with a refractive index of n1 into a region with a refractive index n2 the path
When a ray of light passes from a region with a refractive index of n1 into a region with a refractive index n2 the path of the light ray is bent according to Snell's Law: n1*sin(angle1) = n2*sin(angle2) where angle1 is the angle of the incoming ray and angle2 is the angle of the outgoing ray. angle1 is measured counterclockwise from the plus y axis and angle2 is measured counterclockwise from the negative y axis. Given the values of n1, n2, and angle1 the value of angle2 is calculated from: angle2 = arcsin(n1/n2*sin(angle1))
If n1 > n2 then for some values of angle1 the above equation will have no real solutions. In this case, the light ray is reflected, a phenomenon known as total internal reflection (TIR). To calculate angle2 in the case of TIR, use the fact that the reflected ray makes an angle with the positive y axis that is equal but opposite in sign to the incoming ray.
Write a MatLab program that prompts the user for n1, n2, and angle1 and computes angle2. Note that in the case of TIR the outgoing angle is the negative of the incoming angle if both are measured from the positive y axis, but to be consistent with Snell's Law, you need to output the outgoing angle relative to the negative y axis.
Think carefully about the condition in the if statement. Note that if n1 > n2 the problem says you may get TIR. It does not say you will get TIR every time n1 > n2. The real issue is that the equation above for computing angle2 involves taking an arcsin, and arcsin only gives real results for arguments in the range [1, +1] outside this range the result is a complex number.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started