光学:绘制 TE 和 TM 的相移

optics: Plot phase shift for both TE en TM

我正在尝试绘制具有可变入射角(0 到 180 度)的垂直波和平行波的相移。波从折射率为 1.33 的介质传播到折射率为 1.5 的介质。

我使用了以下方程式:Theory with equations <-- 第 18 页

我使用了以下代码:

def Phase(theta):

    n=1.5/1.33

    Shift=np.sqrt(np.sin(theta*np.pi/180)**2-n**2)
    Shift=Shift/np.cos(theta*np.pi/180)
    Shift=2*np.degrees(np.arctan(Shift))

    return Shift

print(Phase(x))

x=np.linspace(0,180,30)  

问题是我得到 [ nan nan nan nan nan nan nan nan nan nan] 作为 return。

您使用的是全内反射 (TIR) 方程,该方程对 theta > theta_critical 有效。您需要将输入角度限制在此范围内。此外,这些方程式要求 n < 1,其中 n 定义为透射介质与入射介质的比率。对于 TIR,您将从较高的索引转到较低的索引,因此 n = n_2/n_1 = 1.33/1.5。最后,入射角是相对于表面法线定义的,因此它们应该在 0 <= theta <= 90° 的范围内。

如果您的代码如图所示,则您在赋值前使用了 x。

试试这个:

def Phase(theta):

    n=1.5/1.33

    Shift=np.sqrt(np.sin(theta*np.pi/180)**2-n**2)
    Shift=Shift/np.cos(theta*np.pi/180)
    Shift=2*np.degrees(np.arctan(Shift))

    return Shift

x=np.linspace(0,180,30) 
print(Phase(x))