📄 plotfield.m
字号:
function plotfield(mesh,vals,titstr)% Creates an arrow plot of a vectorfield whose values are stored% in the vals column vector%% mesh -> Data for 2D unstructured mesh% vals -> column vector whose length must agree with mesh.Nv%if (size(vals,1) ~= 2*mesh.Nv), error('Size mismatch for argument vector'); endif (size(vals,2) ~= 1), error('Vals must be a colun vector'); endif (nargin < 3), titstr = 'Arrowplot of vectorfield'; endhold on;title(titstr);bb = [ 0 0 0 0 ];% Plot boundary of domainebd_idx = find(mesh.ebfl(:,1) ~= 0);for i=ebd_idx' ev = [mesh.vt(mesh.ep(i,1),:)' mesh.vt(mesh.ep(i,2),:)']; plot(ev(1,:),ev(2,:),'k-'); bb = [ min([ev(1,1),ev(1,2),bb(1)]),... max([ev(1,1),ev(1,2),bb(2)]),... min([ev(2,1),ev(2,2),bb(3)]),... max([ev(2,1),ev(2,2),bb(4)]) ];end% Plot arrowsvx = vals(1:2:2*mesh.Nv,1);vy = vals(2:2:2*mesh.Nv,1);quiver(mesh.vt(:,1),mesh.vt(:,2),vx,vy,0.75,'b-');axis(bb);hold off;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -