Verifying the Law of Refraction Using MATLAB
[Copy link]
Verifying the Law of Refraction Using MATLAB
The law of refraction, also known as Snell's Law, is simply described as follows: the ratio of the sine of the incident angle of the light ray to the sine of the refraction angle is a constant. It can be written as:
sinθ1*n1=sinθ2*n2
Where θ1/θ2 are the incident angle and the exit angle, respectively, and n1/n2 are the refractive indices of medium 1 and medium 2, respectively.
There are many ways to prove this law. This article uses Fermat's principle and performs calculations through MATLAB.
Fermat's principle states that the propagation path of light satisfies the principle of stationary time. That is, the path with the most stable time change. The propagation speed of light V=C/n, that is, the propagation speed of light in different media is different.
Figure 1
As shown in Figure 1, the light passes through point Xi from point P, enters medium n2 from medium n1, and reaches point Q. The position of xi is calculated according to Fermat's principle, thereby verifying the law of refraction. The time from point P to point Q is:
We can draw a (T, x) curve using MATLAB, and we can see that in this curve, T has only a minimum value. By finding the x value corresponding to the minimum value, we can get the only incident point.
Figure 2 shows the calculated results.
The conditions are: a=2; b=2; l=8; n1=1; n2=1.8;
Figure II
Figure 3 is a diagram of the connected optical paths.
Figure 3
Through simple calculations, the law of refraction can be verified: sinθ1*n1=sinθ2*n2.
|
x |
y |
R = sqrt (x^2+y^2) |
SINθ(=X/R) |
n |
SINθ*n |
Incident P |
6.75 |
2 |
7.040064 |
0.958798113 |
1 |
0.9587981 |
Refraction Q |
1.25 |
2 |
2.358495 |
0.52999894 |
1.8 |
0.9539981 |
The law of refraction can also be proved by directly taking the derivative of the T(x) function with respect to x to make T'(x)=0.
|