从一些有限元建模软件中,我得到了一些函数在三维体积上的价值.我想把这个函数的值与卷的值结合起来。麻烦的是,从FEM软件导出的数据并没有定义规则网格上的函数,而是定义了对应于有限元软件所使用的(不均匀)网格的点集合(x、y、z)。
如何在Matlab中完成这种集成?
发布于 2013-08-21 15:59:46
一种方法是使用TriScatteredInterp将函数重采样到常规网格上:
% Suppose f gives values of the function at points (x,y,z)
% Here we will resample f onto a regular grid.
% Define the x, y, and z axis vectors for the new grid.
xg = linspace(min(x), max(x), 100);
yg = linspace(min(y), max(y), 100);
zg = linspace(min(z), max(z), 100);
% Define the new grid
[Xg, Yg, Zg] = meshgrid(xg, yg, zg);
% Define an interpolator for the sampled function
F = TriScatteredInterp(x, y, z, f);
Fg = F(Xg, Yg, Zg);
% Now we have the function sampled on a regular grid and can use the
% traditional matlab techniques.
dx = xg(2) - xg(1);
dy = yg(2) - yg(1);
dz = zg(2) - zg(1);
my_integral = sum(sum(sum(Fg))) * dx*dy*dz;但还有更好的方法吗?
https://stackoverflow.com/questions/18362286
复制相似问题