📄 blochdiff.m
字号:
function D=BlochDiff(M,n,d,f)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 KappaX KappaY LX LY X Y
global BoundaryType
if BoundaryType==0
xCoef=0;
yCoef=0;
elseif BoundaryType==1
xCoef=1;
yCoef=1;
elseif BoundaryType==2 | BoundaryType==4
xCoef=1;
yCoef=0;
elseif BoundaryType==3 | BoundaryType==5
xCoef=0;
yCoef=1;
elseif BoundaryType==6
xCoef=f;
yCoef=f;
end
if d==+1 % Forward Difference
if n==1 % x Difference
R=xCoef*exp(-j*KappaX*LX)*M(1,:);
N=[M;R];
else % y Difference
C=yCoef*exp(-j*KappaY*LY)*M(:,1);
N=[M C];
end
else % Backward Difference
if n==1 % x Difference
R=xCoef*exp(+j*KappaX*LX)*M(X,:);
N=[R; M];
else % y Difference
C=yCoef*exp(+j*KappaY*LY)*M(:,Y);
N=[C M];
end
end
D=diff(N,1,n);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -