⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 integrate.m

📁 AQUILA is a MATLAB toolbox for the one- or twodimensional simulation of %the electronic properties
💻 M
字号:
function integral=integrate(field,posbox)

%INTEGRATE integrate a field
%
%integral=integrate(field,posbox)
%
%integrates field over the area defined in posbox
%posbox=[xmin ymin xmax ymax] for 2D
%posbox=[xmin xmax] for 1D
%
%Note: the routine finds the grid nodes contained in the box defined in posbox
%   and sums the values of the corresponding nodes weighted by the area covered
%   by these nodes. It does not correctly handle positions between nodes.

%Copyright 1999 Martin Rother
%
%This file is part of AQUILA.
%
%AQUILA is free software; you can redistribute it and/or modify
%it under the terms of the GNU General Public License as published by
%the Free Software Foundation; either version 2 of the License, or
%(at your option) any later version.
%
%AQUILA is distributed in the hope that it will be useful,
%but WITHOUT ANY WARRANTY; without even the implied warranty of
%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%GNU General Public License for more details.
%
%You should have received a copy of the GNU General Public License
%along with AQUILA; if not, write to the Free Software
%Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

global aquila_structure aquila_control

%check execution order
if bitget(aquila_control.progress_check,6)==0
   error('integrate: You must run BUILDSTRUCTURE before integrating in the structure !')
end

%for 1D simulation extend position box
if length(posbox)==2
   posbox=[posbox(1) 0 posbox(2) 0];
end

%find position of given box within global grid
[ix,iy]=boxindex(aquila_structure.xpos,aquila_structure.ypos,posbox);
ix=[ix ix(end)+1];
if aquila_control.mode==2
   iy=[iy iy(end)+1];
end

%summation weighted by boxvolume
integral=sum(sum(field(iy,ix).*aquila_structure.boxvol(iy,ix)));

⌨️ 快捷键说明

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