bgcond.m
来自「生成三维模型异常体填充文件」· M 代码 · 共 33 行
M
33 行
function sb = bgcond(h,sig,x,y,z)
% ----------------------------------------------
% Computing background conductivity in the mesh
% ----------------------------------------------
%
% h : vector of layer thicknesses, [] for halfspace
% sig : vector of layer conductivities
% x : vector of the x coordinates of the mesh
% y : vector of the y coordinates of the mesh
% z : vector of the z coordinates of the mesh
% sb : Nxyz,1 vector of background conductivity
h = (h(:))';
Nx=length(x); Ny=length(y); Nz=length(z);
Nxyz=Nx*Ny*Nz;
nl = length(sig);
h=[0 h inf];
zbnd=zeros(1,length(h));
zbnd(1)=h(1);
for i=2:length(h)
zbnd(i)=zbnd(i-1)+h(i);
end
sb = zeros(0,1);
for i=1:nl
ind = find((z>zbnd(i)) & (z<zbnd(i+1)));
numc=length(ind)*Nx*Ny;
sb=[sb;sig(i)*ones(numc,1)];
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?