?? integrate.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)));
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -