• Matlab绘制单元,云图


    四结点的平面单元

    function plot_plane_4_nodes(p,t,U)
        %%% 传入的t需要是Nelem*m的,Nelem的是单元总数,m是一个单元含有的结点数目
        %%% 传入的p是Nnode*3的,Nnode的是结点总数,3列坐标分别为Xcoord,Ycoord,Zcoord
        %%% 传入的U是列向量,数目和p的行数相同
    figure;axis equal
    %===== map =====
    map = [0 0 255;
           0 160 255;
           0 255 255;
           0 255 160;
           0 255 0;
           178 255 0;
           255 255 0;
           255 145 0;
          255 0 0;]./255;
    colormap(map)
    
    %%% 'Faces'后面的参数指定哪些结点构成一个面(每一行是一个面的顶点编号),即单元信息
    %%% 'Vertices'后面的参数是一系列顶点坐标(每一行是一个顶点坐标),即结点信息
    %%% 'FaceVertexCData'后面的参数是一系列顶点坐标的值,会自动插值颜色,值即结点位移
    ss=patch('Faces',t(:,[1,2,3,4]),'Vertices',p,'FaceVertexCData',U);
    ss.FaceColor = 'interp';
    ss.EdgeColor='black';   %%%  none , white
    ss.LineStyle = '-'; 
    ss.LineWidth = 0.01;
    colorbar

    六面体或四面体绘制6个面或者4个面即可

    edge_color = 'black';
    patch('Faces',t(:,[1,2,3,4]),'Vertices',p1,'FaceColor','interp','EdgeColor',edge_color,'FaceVertexCData',U);
    patch('Faces',t(:,[5,6,7,8]),'Vertices',p1,'FaceColor','interp','EdgeColor',edge_color,'FaceVertexCData',U);
    patch('Faces',t(:,[1,5,8,4]),'Vertices',p1,'FaceColor','interp','EdgeColor',edge_color,'FaceVertexCData',U);
    patch('Faces',t(:,[2,6,7,3]),'Vertices',p1,'FaceColor','interp','EdgeColor',edge_color,'FaceVertexCData',U);
    patch('Faces',t(:,[1,2,6,5]),'Vertices',p1,'FaceColor','interp','EdgeColor',edge_color,'FaceVertexCData',U);
    ss=patch('Faces',t(:,[4,3,7,8]),'Vertices',p1,'FaceColor','flat','EdgeColor',edge_color,'FaceVertexCData',U);
    ss.FaceColor = 'interp';


    转载仅为学习,不会商用。
    欢迎转载原创,附文链接。
  • 相关阅读:
    virtualenv的使用
    node.js报错:Cannot find module 'xxx'的解决办法
    mysql
    cProfile分析程序性能
    python实现一个无序单链表
    修改pycharm中的flask项目名遇到的坑
    Model class apps.goods.models.GoodsType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS
    已安装的nginx添加其他模块
    pip install 一个本地包时提示error: Microsoft Visual C++ 14.0 is required.
    解决adober reader已停止工作的问题
  • 原文地址:https://www.cnblogs.com/xdd1997/p/14696295.html
Copyright © 2020-2023  润新知