0

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

我使用了以下方程:方程理论<-- 第 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]了回报。

4

2 回答 2

1

如果您的代码如图所示,则您在分配前使用 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))
于 2017-12-31T23:58:19.890 回答
0

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

于 2017-12-31T17:44:46.200 回答