-3
我想写一个函数,它在网格中创建一个带球的3D网格。它应该是3D。 我发现this example,这正是我想要的,但我不知道如何将它添加到函数m文件中。Matlab:如何创建3D网格?
这是我的代码:
function kgrid = makeGrid(Nx, dx, Ny, dy);
% create the computational grid
Nx = 64; % number of grid points in the x direction
Ny = 64; % number of grid points in the y direction
Nz = 64; % number of grid points in the z direction
dx = 0.1e-3; % grid point spacing in the x direction [m]
dy = 0.1e-3; % grid point spacing in the y direction [m]
dz = 0.1e-3; % grid point spacing in the z direction [m]
kgrid = makeGrid(Nx, dx, Ny, dy, Nz, dz);
end