1

いくつかの有限要素モデリング ソフトウェアから、3 次元ボリューム上の関数の値を取得しました。この機能の価値をボリュームに統合したいと考えています。問題は、FEM ソフトウェアからエクスポートされたデータが、通常のグリッド上で関数を定義するのではなく、FEM ソフトウェアで使用される (不均一な) メッシュに対応する点 (x、y、z) のコレクション上で関数を定義することです。

この統合を Matlab で行うにはどうすればよいですか?

4

1 に答える 1

2

1 つのアプローチは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;

しかし、より良い方法はありますか?

于 2013-08-21T15:59:46.033 に答える