FEM-Course-Matlab/8.Matlab有限元结果后处理(不规则形状云图绘制)/main.m

61 lines
1.5 KiB
Matlab
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

clear all;clc;
close all;
%提取节点坐标和节点物理量
q1up=xlsread('204K_tipup.csv');
q1down=xlsread('204K_tipdown.csv');
QQ1up=xlsread('214K_tipup.csv');
QQ1down=xlsread('214K_tipdown.csv');
XXX=q1up(:,2);
X_min=min(XXX);
X_max=max(XXX);
Coord=X_max-X_min;
XXXX=(XXX-X_min)/Coord;
YYY=q1up(:,3);
Y_min=min(YYY);
Y_max=max(YYY);
YYYY=(YYY-Y_min)/Coord;
X=q1down(:,2);
XX=(X-X_min)/Coord;%***
Y=q1down(:,3);
YY=(Y-Y_min)/Coord;%%***
HTC_down=-(q1down(:,5)-QQ1down(:,5))./(10);%***
% HTC_up=-(q1up(:,5)-QQ1up(:,5))./(10);
%根据离散点构建多边形
SHP1=alphaShape(XX,YY,0.01,'HoleThreshold',0.000001);
%填充 alpha 形状的三角剖分返回tri 中的每一行指定一个由顶点 IDshp.Points 矩阵的行号)定义的三角形。
tri1=alphaTriangulation(SHP1);
% SHP2=alphaShape(XXXX,YYYY,0.01,'HoleThreshold',0.000001);
% tri2=alphaTriangulation(SHP2);
aa=figure(11)
plot(SHP1);
title('Mesh');
% hold on
% plot(SHP2);
%parameters of the figure
cmin=0;
cmax=2000;
w1=800;
w2=800;
fonts=20;
figure(1)
patch('Faces',tri1,'Vertices',[XX,YY],'facevertexCdata',HTC_down,'edgecolor','none','facecolor','interp');%'interp' or 'flat';interp smooth the color
hold on
axis equal;
% patch('Faces',tri2,'Vertices',[XXXX,YYYY],'facevertexCdata',HTC_up,'edgecolor','none','facecolor','interp');
colormap(jet);
% axis([0 1 0 1.0])
caxis([cmin cmax]);
colorbar('southoutside');
xlabel('x/Cx');
ylabel('y/Cx');
title('Tips HTC (0.4Ma 214K)');
set(gca,'FontName','Times New Roman','FontSize',fonts,'LineWidth',1);
% set(gcf, 'position', [0 0 w1 w2]);
saveas(1,'Tips HTC (0.4Ma 214K).png');