grid3dt.m
来自「This toolbox contains Matlab code for se」· M 代码 · 共 39 行
M
39 行
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 + =
减小字号Ctrl + -
显示快捷键?