You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.0 KiB
68 lines
2.0 KiB
%--------------------------
|
|
% @Author: Jingqiao Hu
|
|
% @Date: 2021-03-13 11:24:14
|
|
% @LastEditTime: 2021-04-15 20:27:16
|
|
%--------------------------
|
|
function h = plot_deformation(deform_nodes, edofMat, rho, datapath)
|
|
|
|
defn = reshape(deform_nodes', [], 1);
|
|
|
|
nele = size(edofMat, 1);
|
|
global_cx = zeros(4, nele);
|
|
global_cy = zeros(4, nele);
|
|
global_info = zeros(4, nele);
|
|
|
|
for ele = 1 : nele
|
|
edof = edofMat(ele, :);
|
|
coor = reshape(defn(edof), 2, [])'; % [4,2]
|
|
|
|
global_cx(:, ele) = coor(:,1);
|
|
global_cy(:, ele) = coor(:,2);
|
|
global_info(:, ele) = repmat(rho(ele), 4, 1);
|
|
end
|
|
|
|
h = fill(global_cx, global_cy, 1-global_info); axis equal;
|
|
set(h, {'LineStyle'}, {'none'});
|
|
% colormap('Bone'); caxis([0,1]);
|
|
|
|
grid off;
|
|
|
|
% % linear
|
|
% xlim([0, 5.2]); xticks(linspace(0,5.2,5)); %xticklabels(['','','','','','']);
|
|
% ylim([-4.5, 2]); yticks(linspace(-4.5,2,6));
|
|
|
|
% nonlinear
|
|
% xlim([0, 8.4]); xticks(linspace(0,8.4,4)); %xticklabels(['','','','','','']);
|
|
% ylim([-2, 5]); yticks(linspace(-2,5,5));
|
|
|
|
% only plotting y-axis
|
|
% set(gca,'XColor','white');
|
|
% set(gca,'Color','white');
|
|
% box off;
|
|
|
|
xlabel('X','Color','k','FontSize',14);
|
|
ylabel('Y','Color','k','FontSize',14);
|
|
set(gca,'FontSize',14,'FontWeight','bold');
|
|
|
|
% map = [ 0.61, 0.61, 0.61
|
|
% 0.87, 0.87, 0.87];
|
|
% colormap(map);
|
|
|
|
set(h, {'LineStyle'}, {'none'}, 'facealpha', 0.6);
|
|
map = [ 0.4, 0.4, 0.4
|
|
0.83, 0.83, 0.83];
|
|
colormap(map); axis off;
|
|
|
|
% set(h, 'facealpha', 0.6);
|
|
% colormap(parula); caxis([-3,0]); axis off;
|
|
%
|
|
% % save as pdf
|
|
% h = gcf;
|
|
% set(h,'Units','Inches');
|
|
% pos = get(h,'Position');
|
|
% set(h,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)])
|
|
% print(h, 'tmp.pdf','-dpdf','-r0')
|
|
|
|
% fig = gcf; fig.PaperPositionMode = 'auto';
|
|
% print(datapath,'-dpdf','-fillpage');
|
|
end
|