📄 addsource.m
字号:
function AddSource
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Electromagnetic Finite-Difference Time-Domain %
% Version 1.20, Release 1 %
% %
% (C) Copyright 2005 %
% Sharif University of Technology %
% School of Electrical Engineering %
% All Rights Reserved %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global dT Time U Tx Ty Source Y LatticeCnt xPMLCnt
global NormalizedFrequency DiffusionLength yPMLCnt
global SourceWidth SourceDuration Profile
global xSource ySource Mode TE TM
if Time>SourceDuration | Source==0
return
end
t=(Time-1)*dT;
w=2*pi*NormalizedFrequency/LatticeCnt;
if Source==1
U(xSource+xPMLCnt,ySource+yPMLCnt)=sin(w*t);
else
y=((1:Y)-Y/2)/sqrt(Y)/DiffusionLength;
ymin=round(Y/2-SourceWidth/2);
ymax=round(Y/2+SourceWidth/2);
x=xSource+xPMLCnt;
U(x-1,ymin:ymax)=0; % Deactivate for bidirectional plane source
U(x,ymin:ymax)=sin(w*t)*Profile(ymin:ymax);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -