以下是MATLAB代码,用于计算平面波的反射和透射情况:

% 材料1到材料2的全内反射
n1 = 1.45; % 材料1的折射率
n2 = 1.33; % 材料2的折射率
theta_i = linspace(0, 90, 100); % 入射角范围(0到90度)
theta_i_rad = deg2rad(theta_i); % 将入射角转换为弧度

% 计算临界角和布儒斯特角
critical_angle = asind(n2/n1); % 临界角
brewster_angle = atan(n2/n1); % 布儒斯特角

% 计算反射和透射的场强和相位
% TE波(s波)
r_TE = (n1*cos(theta_i_rad) - n2*sqrt(1 - (n1/n2*sin(theta_i_rad)).^2)) ./ (n1*cos(theta_i_rad) + n2*sqrt(1 - (n1/n2*sin(theta_i_rad)).^2));
t_TE = (2*n1*cos(theta_i_rad)) ./ (n1*cos(theta_i_rad) + n2*sqrt(1 - (n1/n2*sin(theta_i_rad)).^2));

% TM波(p波)
r_TM = (n2*cos(theta_i_rad) - n1*sqrt(1 - (n1/n2*sin(theta_i_rad)).^2)) ./ (n2*cos(theta_i_rad) + n1*sqrt(1 - (n1/n2*sin(theta_i_rad)).^2));
t_TM = (2*n1*cos(theta_i_rad)) ./ (n2*cos(theta_i_rad) + n1*sqrt(1 - (n1/n2*sin(theta_i_rad)).^2));

% 计算反射和透射光场强的强度和相位
R_TE = abs(r_TE).^2;
R_TM = abs(r_TM).^2;
T_TE = n2*cos(theta_i_rad).*abs(t_TE).^2./cos(theta_i_rad); % 注意透射光场强需要乘以折射率
T_TM = n2*cos(theta_i_rad).*abs(t_TM).^2./cos(theta_i_rad);
phi_TE = angle(r_TE);
phi_TM = angle(r_TM);

% 绘制反射和透射光场强随入射角的关系图
figure;
plot(theta_i, R_TE, 'r', 'LineWidth', 2);
hold on;
plot(theta_i, R_TM, 'b', 'LineWidth', 2);
plot(theta_i, T_TE, 'g', 'LineWidth', 2);
plot(theta_i, T_TM, 'm', 'LineWidth', 2);
xlabel('入射角(度)');
ylabel('光场强');
title('反射和透射光场强随入射角的关系');
legend('TE反射光场强', 'TM反射光场强', 'TE透射光场强', 'TM透射光场强');
grid on;

% 绘制反射光场强和入射光场强的相位随入射角的关系图
figure;
plot(theta_i, phi_TE, 'r', 'LineWidth', 2);
hold on;
plot(theta_i, phi_TM, 'b', 'LineWidth', 2);
xlabel('入射角(度)');
ylabel('相位(弧度)');
title('反射光场强和入射光场强的相位随入射角的关系');
legend('TE波相位', 'TM波相位');
grid on;

该代码使用菲涅尔公式,并区分了TE波(s波)和TM波(p波),分别计算了反射和透射的场强和相位。根据输入的折射率、入射角范围,计算了全内反射和非全内反射的情况下,反射和透射光场强随入射角的变化,并绘制了相应的图形。同时,还计算了反射光场强和入射光场强的相位随入射角的变化,并进行了图形展示。

请注意,菲涅尔公式是近似计算,对于实际情况可能存在一定的偏差。此外,代码中的角度单位统一使用度(°),但计算时需要将角度转换为弧度进行计算。

MATLAB代码:平面波的反射和透射(菲涅尔公式)

原文地址: https://www.cveoy.top/t/topic/clws 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录