-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlotMesh.m
64 lines (53 loc) · 1.12 KB
/
PlotMesh.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
function PlotMesh(T,X,elem,str,nonum)
% PlotMesh(T,X,str,nonum)
% X: nodal coordinates
% T: connectivities
% str: linestyle, color and marker used in the plot (optional)
% nonum = 1 to show nodes' number(optional)
% Line style and color
if nargin == 3
str1 = 'yo';
str2 = 'y-';
else
if str(1) == ':' | str(1) == '-'
str1 = 'yo';
str2 = ['y' str];
else
str1 = [str(1) 'o'];
str2 = str;
end
end
nen = size(T,2);
if elem == 0
if nen <= 4
order = [1:nen,1];
elseif nen == 9
order = [1,5,2,6,3,7,4,8,1];
end
elseif elem == 1
if nen <= 3
order = [1:nen,1];
elseif nen == 6
order = [1,4,2,5,3,6,1];
end
elseif elem == 11
order = [1:3,1];
end
% Nodes
plot(X(:,1),X(:,2),str1)
hold on
% Elements
for j = 1:size(T,1)
plot(X(T(j,order),1),X(T(j,order),2),str2)
end
% nodes number
if nargin==5
if nonum==1
for I=1:size(X,1)
text(X(I,1)+0.02,X(I,2)+0.03,int2str(I),'FontSize',16)
end
end
end
axis('equal')
axis('off')
hold off