plotsnapshot.m

来自「fdtd计算二维光子晶体带隙」· M 代码 · 共 43 行

M
43
字号
function PlotSnapshot

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 U X Y xPMLCnt yPMLCnt BoundaryType Time dT
global Mode TE TM Epsilon Mu StructureColor
global ShowStructure ShowPML False True

e=abs(BlochDiff(Epsilon,1,1,0))+abs(BlochDiff(Mu,1,1,0))+...
  abs(BlochDiff(Epsilon,2,1,0))+abs(BlochDiff(Mu,2,1,0));
e=sign(e);
V=real(U);
a=(2*max(max(V))+min(min(V)))*StructureColor;

if ShowStructure==True
   V=(1-e).*real(V)+a*e;
end

if ShowPML==False
   V=V(xPMLCnt+1:X-xPMLCnt,yPMLCnt+1:Y-yPMLCnt);
end

figure(1); 
surf(V.')
view(2)
shading interp
axis equal
axis tight

if Mode==TE
    t=sprintf('TE Field (Timestep=%g, Normalized Time=%g)',Time,(Time-1)*dT);
else
    t=sprintf('TM Field (Timestep=%g, Normalized Time=%g)',Time,(Time-1)*dT);
end
title(t)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?