-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