📄 electronic.m
字号:
%electronic field;
%copyright 属于研学论坛bbs.matwav.com和plasma
%physical constant;
clear all;
n=4;
pi=3.1415926;
e0=1;
v=100;%m/s
omega=10;% angle frequent;
k=omega/v;%% wave number(0.1)
%f=2*pi/omega;%hz
lambla=2*pi*v/omega;%(lambla=20pi)
T=2*pi/omega;%(T=.2pis)
d=2*lambla;%(d=200pi)
%fix the simulation zone;
%Next, set up the first plot as before, except using the default EraseMode (normal).
xmax=5*lambla;
zmax=20*lambla;
[x,z] = meshgrid([0:.05*lambla:d]);
%x=0:.1*lambla:2*lambla;
%z=0:.1*lambla:2*lambla;
%for i=1:40;
% for j=1:40;
% ef(i,j)=e0*sin(n*pi*i*0.1*lambla/d).*cos(omega*t-k*j*0.1*lambla);
% end
%end
%Generate the movie and use getframe to capture each frame.
%ef=sin(n*pi*x/d).*cos(omega*t);
%contour(ef,30);
framemax=100;
%E=2*E0*cos(t*delta_omega-delta_beta*vg*t+pi*n/framemax).*cos(omega0*t-beta0*vp*t+2*pi*n/framemax);
zero=0*x;
%for t=0:delt_t:4*T;
for t=1:framemax
ef=e0*sin(n*pi*x/d).*cos(2*pi*t/framemax-k*z);
%ef=e0*sin(n*pi*x/d).*cos(k*z);
%ef1=e0*sin(n*pi*x/d)*cos(2*pi*t/framemax);
for ii=t:1:length(z);
for jj=1:length(z);
ef(ii,jj)=0;
end
end
h1=0;
subplot(2,2,2);
%h1=surf(ef);%如果用这个加上axis命令
h2=contourf(ef,12);%可以看出z正向传播
xlabel('axis x');
ylabel('axis z');
zlabel('electric field');
%Elcetric field distribution along x at z=0
colorbar;
M(t)=getframe;
subplot(2,2,4);
h3=plot(x(1,:)/3.07,ef(1,:));
hold on;
plot(x(1,:)/3.07,zero(1,:));
hold off;
axis([0 41 -1 1]) ;
xlabel('axis x');
ylabel('V/m');
zlabel('Elcetrical field distribution along x at z=0');
M(t)=getframe;
%pause(1);
end
movie(M,3);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -