drawmesh.m

来自「解决麦克斯韦的matlab源文件」· M 代码 · 共 37 行

M
37
字号
function drawmesh(mesh,titstr)% Graphical output of 2D unstructured grid%% mesh -> 2D triangulation in special mesh format%if (nargin < 2), titstr = 'Mesh'; end;ebd_idx  = find(mesh.ebfl(:,1) ~= 0);eint_idx = find(mesh.ebfl(:,1) == 0);s = sprintf(' : %d vts, %d edges, %d cells',mesh.Nv,mesh.Ne,mesh.Nt);figure; clf;hold on;title([titstr s]);for i=eint_idx'  ev = [mesh.vt(mesh.ep(i,1),:)' mesh.vt(mesh.ep(i,2),:)'];   plot(ev(1,:),ev(2,:),'b-');endfor i=ebd_idx'  ev = [mesh.vt(mesh.ep(i,1),:)' mesh.vt(mesh.ep(i,2),:)'];   plot(ev(1,:),ev(2,:),'r-');endhold off;figure; clf;hold on;title(s);quiver(mesh.vt(mesh.ep(eint_idx,1),1),mesh.vt(mesh.ep(eint_idx,1),2),...       mesh.vt(mesh.ep(eint_idx,2),1)-mesh.vt(mesh.ep(eint_idx,1),1),...       mesh.vt(mesh.ep(eint_idx,2),2)-mesh.vt(mesh.ep(eint_idx,1),2),0,'-b');quiver(mesh.vt(mesh.ep(ebd_idx,1),1),mesh.vt(mesh.ep(ebd_idx,1),2),...       mesh.vt(mesh.ep(ebd_idx,2),1)-mesh.vt(mesh.ep(ebd_idx,1),1),...       mesh.vt(mesh.ep(ebd_idx,2),2)-mesh.vt(mesh.ep(ebd_idx,1),2),0,'-r');hold off;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?