1 function X=regular_mesh(n,h,v)
3 % Creates a regular mesh that is stretched in the vertical direction but
4 % uniform horizationally.
5 % Use plot_mesh_3d(X) to see the result.
7 % n size 3 number of cells in each direction
8 % h size 3 step size in each direction
9 % v size 1 vertical stretch factor
11 % X cell array with x y z grid coordinates
18 zz(i+1) = zz(i) + h(3) * v^(i-1);
20 [x,y,z] = ndgrid(h(1)*[0:n(1)],h(2)*[0:n(2)],zz);
22 fprintf('regular_mesh nodes %i %i %i step %g %g %g expansion %g size %g %g %g\n',...
23 n,h,v,n(1)*h(1),n(2)*h(2),zz(end))