-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlotResult2.m
More file actions
93 lines (77 loc) · 2.88 KB
/
PlotResult2.m
File metadata and controls
93 lines (77 loc) · 2.88 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
%------------------------------------------------------------------
% PlotResult plot the desirable result: stress, displacement
% It receives the following parameters:
% nodecoordinates: all node coordinates
% elemNodes: the nodes of each element
% component to be plotted as a profile
% string is the component: 'UX', 'UY', 'sigmaXX', ...
function PlotResult2(nodecoordinates, elemNodes, elemat, factor,component, string, Lx, Ly)
scale = min(Lx, Ly);
if abs(scale) < 0.5
axis([ -0.15 Lx+0.15 -0.15 Ly+0.15 ]);
end
nel = length(elemNodes) ; % number of elements
nnode = length(nodecoordinates) ; % total number of nodes in system
nnel = 4;
nquads = nel;
X(4, nquads) = 0;
Y(4, nquads) = 0;
profile = zeros(4,nquads);
for iel = 1:nel
for i = 1:nnel
node = elemNodes{1,iel}(i);
X(i, iel) = nodecoordinates{1,node}(1);
Y(i, iel) = nodecoordinates{1,node}(2);
profile(i,iel) = component(node) ;
end
end
plot(X,Y,'k')
fill(X,Y,profile)
clear X Y profile node
if strcmp(string, 'UX') == 1
title('Profile of UX on Mesh') ;
elseif strcmp(string, 'UY') == 1
title('Profile of UY on Mesh') ;
elseif strcmp(string, 'sigmaXX') == 1
title('Profile of sigmaXX on Mesh') ;
elseif strcmp(string, 'sigmaYY') == 1
title('Profile of sigmaYY on Mesh') ;
elseif strcmp(string, 'sigmaXY') == 1
title('Profile of sigmaXY on Mesh') ;
end
%axis equal
%axis off ;
% Colorbar Setting
alpha(1);
SetColorbar
end
%bar shoing the max and min values of the profile
function SetColorbar
cbar = colorbar;
% Dimensions of the colorbar
% cpos = get(cbar,'position');
% cpos(3) = cpos(3)/4 ; % Reduce the width of colorbar by half
% cpos(2) = cpos(2)+.1 ;
% cpos(4) = cpos(4)-.2 ;
%set(cbar,'Position',cpos) ;
%brighten(0.5);
% Title of the colorbar
set(get(cbar,'title'),'string','VAL');
%locate = get(cbar,'title');
%tpos = get(locate,'position');
%tpos(3) = tpos(3)+5. ;
%set(locate,'pos',tpos);
% Setting the values on colorbar
%
% get the color limits
clim = caxis;
ylim(cbar,[clim(1) clim(2)]);
numpts = 24 ; % Number of points to be displayed on colorbar
kssv = linspace(clim(1),clim(2),numpts);
set(cbar,'YtickMode','manual','YTick',kssv); % Set the tickmode to manual
for i = 1:numpts
imep = num2str(kssv(i),'%+3.2E');
vasu(i) = {imep} ;
end
set(cbar,'YTickLabel',vasu(1:numpts),'fontsize',9);
end