-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlotDeformedMesh2.m
More file actions
86 lines (73 loc) · 2.64 KB
/
PlotDeformedMesh2.m
File metadata and controls
86 lines (73 loc) · 2.64 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
%------------------------------------------------------------------
% PlotDeformedMesh the deformed mesh
% It receives the following parameters:
% nodecoordinates: all node coordinates
% elemNodes: the nodes of each element
function PlotDeformedMesh2(nodecoordinates, elemNodes, elemat, factor,noddisplacement, 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;
ux = noddisplacement(:,1) ;
uy = noddisplacement(:,2) ;
utotal = sqrt( ux.*ux+uy.*uy );
X(4, nel) = 0;
Y(4, nel) = 0;
UX = zeros(4,nel) ;
UY = zeros(4,nel) ;
profile = zeros(4,nel);
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);
UX(i,iel) = ux(node) ;
UY(i,iel) = uy(node) ;
profile(i,iel) = utotal(node) ;
end
end
defoX = X+factor*UX ;
defoY = Y+factor*UY ;
%figure
plot(defoX,defoY,'k')
fill(defoX,defoY,profile)
clear X Y UX UY profile node
title('Profile of Utotal on deformed Mesh') ;
%axis equal
%axis off ;
% Colorbar Setting
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