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

    function MeasurePower

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 PowerTime PowerPlanes U Ty yPMLCnt Y
global Power PowerTime TimeSteps

for i=1:length(PowerPlanes)
    x=PowerPlanes(i);
    S=sum(U(x,yPMLCnt+1:Y-yPMLCnt).*Ty(x,yPMLCnt+1:Y-yPMLCnt));
    Power(i)=Power(i)-S/(TimeSteps-PowerTime+1);
end