📄 grid3dt.m
字号:
function [A,xyz] = grid3dt(k)% GRID3DT : Generate 3-dimensional tetrahedral finite element mesh.%% [A,xyz] = GRID3DT(k) returns a k^3-by-k^3 symmetric positive definite % matrix A of the k-by-k-by-k grid, with cells divided into tetrahedra, % and an array xyz of coordinates for the grid points.%% John Gilbert, Xerox PARC, 1992.% Copyright (c) 1990-1996 by Xerox Corporation. All rights reserved.% HELP COPYRIGHT for complete copyright and licensing notice.% 1-d mesha = blockdiags ([-1 14 -1], -1:1, k, k);% glue to laminate 1-d meshes into 2-d meshesb = blockdiags ([-1 -1], [0 1], k, k);% 2-d meshaa = blockdiags ([b a b'], -1:1, k, k);% glue to laminate 2-d meshes into 3-d meshesbb = blockdiags ([b b'], [0 1], k, k);% 3-d meshA = blockdiags ([bb aa bb'], -1:1, k, k);% xyz coordinates of nodesxyz = zeros(k^3,3);x = ones(k,1) * (1:k);y = x';j = 1;for i = 1:k slab = j:j+k^2-1; xyz(slab,1) = x(:); xyz(slab,2) = y(:); xyz(slab,3) = i * ones(k^2,1); j = j + k^2;end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -