www.gusucode.com > FDTD计算二维光子带隙的程序 > FDTD计算二维光子带隙的程序/247787/PlotSnapshot.m
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)