www.gusucode.com > FDTD计算二维光子带隙的程序 > FDTD计算二维光子带隙的程序/247787/PlotBandStructure.m

    function PlotBandStructure

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 StructureType BoundaryType a NoDiv AbsolutePhase
global wmin wmax MaximumFreqency TE TM Mode

wmin=0.0;
wmax=MaximumFreqency;

if StructureType <= 0       % Square Lattice
    xPath=[0 pi/a  pi/a];
    yPath=[0 0     pi/a];
    names=['G' 'X' 'M'];
elseif StructureType == 1   % Triangular Lattice
    xPath=[0 sqrt(3)*pi/a/2 sqrt(3)*pi/a/2];
    yPath=[0 0              pi/a/2        ];
    names=['G' 'M' 'K'];
end

if BoundaryType == 1
    mi=1;
    mf=3;
else
    mi=1;   % Direction GX or GK
    mf=1;
%   mi=3;   % Direction MG 
%   mf=3;
end

AbsolutePhase=0;

for m=mi:mf
    m1=m;
    m2=mod(m,3)+1;
    dk=sqrt((xPath(m2)-xPath(m1))^2+(yPath(m2)-yPath(m1))^2);
    fname=strcat(names(m1),names(m2));
    fprintf('\nDirection %s \t',fname)
    PlotBands(fname,dk);
end

fprintf('\n')

axis([0 AbsolutePhase wmin wmax])
if Mode==TE
    title('H-Polarization (TE) Band Structure')
else
    title('E-Polarization (TM) Band Structure')
end