理想介质中的均匀平面波 matlab仿真
1、 实验内容:
2、 实验源码:
% E(z,t) = e EminCos(wt - kz); Em = 100 V/m
% E(0,t) = e EminCos(wt); Em = 100 V/m
% a(相对介电常数) = 1
% b(相对磁导率) = 1
% t = 2T
% f = 1e+9
% w (角频率) = 2 * pi * f
a1 = animatedline('Color',[0 .7 .7]);
f = 1e+9;
axis([0 4000 -100 100]) %y轴振幅和x轴范围
x = linspace(0,100000,10000); %点的描述
w = 2 * pi * f;
for t = 1:length(x)
xk = 1/2 * x(t);
ysin = 100 * cos(xk * w);
addpoints(a1, xk, ysin);
% 屏幕更新
drawnow limitrate
end
xlabel('t时间轴');
ylabel('电场E');
% E(z,t) = e EminCos(wt - kz); Em = 100 V/m
% E(z,0) = e EminCos(-kz); Em = 100 V/m
% a(相对介电常数) = 1
% b(相对磁导率) = 1
% z = 2 * leng(波长)
% f = 1e+9
% 相位常数 k = 2 * pi / leng
a = 1; b = 1; f = 1e+9;
a1 = animatedline('Color',[0 .7 .7]);
%描述坐标轴和点
axis([0 4000 -100 100]) %y轴振幅和x轴范围
x = linspace(0,100000,10000); %点的描述
%描述波长leng和相位常数
leng = 1 / f * sqrt(a * b);
k = 2 * pi / leng;
for z = 1:length(x)
xk = 1/2 * x(z);
y = 100 * cos(-xk * k);
addpoints(a1, xk, y);
% 屏幕更新
drawnow limitrate
xlabel('z传播方向轴');
ylabel('电场E');
end
%电磁参数及计算公式
u0 = 1 * 4*pi*1e-7; %磁导率
e0 = 1 * (1e-9/(36*pi)); %电介质常数
Z0 = sqrt(u0/e0); %波阻抗
f = 1e+7; %入射波频率
w = 2*pi*f; %入射波角频率
k = sqrt(w*(u0*e0)); %波数
phi_E = 0; %电场初始相位
phi_H = 0; %磁场初始相位
EE = 100; %电场幅度
HH = EE/Z0; %磁场幅度
%绘图轴参数
x = 0:0.1:20; %横坐标序列
m0 = zeros(size(x));
y0 = -EE:1:EE; %电场轴范围序列
m1 = zeros(size(y0));
z0 = -HH:0.01:HH; %磁场轴范围序列
m2 = zeros(size(z0));
for t=0:200
Ez = -EE*cos(w*t*1e-9 - k*x + phi_E);%电场幅度序列
Hy = -HH*cos(w*t*1e-9 - k*x + phi_H);%磁场幅度序列
yy = 0:20;
zz = ones(size(yy))*0;
[yy, zz] = meshgrid(yy,zz);
xx = yy*0+20;
mesh(xx,yy,zz,'FaceColor','g');
hold on
%设置xoy面及z轴的坐标轴
plot3(x,m0,m0,'black','Linewidth',3);
hold on
plot3(m1,y0,m1,'black','Linewidth',1.5);
hold on
plot3(m2,m2,z0,'black','Linewidth',1.5);
hold on
%绘制z轴、y轴方向的电场线
plot3(x,Ez,m0,'green','LineWidth',1.2);
hold on
plot3(x,m0,Hy,'blue','LineWidth',1.2);
hold off
%设置坐标属性
xlabel('传播方向');
ylabel('电场Ey');
zlabel('磁场Hz');
title(['平面电磁波传播示意图','t=',num2str(t),'ns'],'fontsize',14)
set(gca,'fontsize',12)
drawnow
end
-
觉得有帮助的话,点个赞再走啦、谢谢啦