待续
%1D FDTD simulation with a simple absorbing boundary condition
% and a TFSF boundary between hy[] and ez[].
SIZE = ;
ez = zeros(,SIZE);
hy = zeros(,SIZE);
imp0=377.0;
maxTime = ; for qTime = : : maxTime
hy(SIZE)=hy(SIZE-);%
for mm = : : SIZE -
hy(mm) = hy(mm) + (ez(mm+)- ez(mm))/imp0;
end
% correction for Hy adjacent to TFSF boundary */
hy()=hy()-exp(-(qTime - )*(qTime - ) / ) / imp0; figure(); t_hy = plot(hy);
title('Magnetic Field');
ez()=ez();%
for mm = : : SIZE
ez(mm) = ez(mm) + (hy(mm)- hy(mm-))*imp0;
end
figure(); t_ez = plot(ez);
title('Electric Field')
ez() = ez() + exp(-(qTime+0.5-(-0.5)-30.0)*(qTime+0.5-(-0.5)-30.0)/100.0); % pause(0.01);
% % refreshdata(t_hy);
% refreshdata(t_ez);
% drawnow;
end