|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
我这有个程序是一本书上FDTD模拟一维吸收条件波传播的,红色部分是吸收条件我看不太懂,哪为大哥帮帮忙详细解释一下啊我只是初学者,谢谢了
%One-Dimension Simulation of EM Field(Absorbing Boudary Condition added)
clear
format long;
KE = 200;
kc= 0.5*KE;
t0 = 40;
spread = 12;
T = 0;
ex_low_m1=0;ex_low_m2 = 0;ex_high_m1=0;ex_high_m2=0;
NSTEPS = 285; %Controllable Step Number
ex = zeros(20);
hy = zeros(20);
for i = 1:NSTEPS
T = T+1;
for k=2:(KE-1)
ex(k) = ex(k) + 0.5*( hy(k-1) - hy(k) );
end;
pulse = exp( -0.5 * ((t0 - T)/spread).^2);
ex(kc) = ex(kc) + pulse ;
ex(1) = ex_low_m2;
ex_low_m2 = ex_low_m1;
ex_low_m1 = ex(2);
ex(KE-1) = ex_high_m2;
ex_high_m2 = ex_high_m1;
ex_high_m1 = ex(KE-2);
for k=1:KE-2
hy(k) = hy(k) + 0.5*( ex(k) - ex(k+1) );
end;
i = 1: KE;
subplot(2,1,1),plot(i,ex(i)),ylabel('Ex'),axis([0,200,-1,1])
subplot(2,1,2),plot(i,hy(i),'r'),xlabel('x'),ylabel('Hy'),axis([0,200,-1,1]);
pause(0.05);
end; |
|