我需要在matlab中生成一个不连续的图(在每个三角形中分段),比如:
这个情节来自http://www.alecjacobson.com/weblog/?p=3616,但我不明白如何生成它。
我有两个矩阵对应于域的三角形网格(典型的有限元方法,即没有重叠的三角形,所有三角形的并集等于域......):
coord=[x1,y1;x2,y2;...;xnod,ynod] % vertices of the mesh
ele =[n1,n2,n3;n1,n2,n3;...;n1,n2,n3] % mesh conectivity
例如:
coord(1,:)=[x1,y1] are the coordinates of vertex 1 of the mesh (vertex of some triangle)
coord(2,:)=[x2,y2] are the coordinates of vertex 2 of the mesh (vertex of some triangle)
etc,
ele(1,:)=[n1,n2,n3] is the number of the vertices of triangle 1
ele(2,:)=[n1,n2,n3] is the number of the vertices of triangle 2
etc.
这样,例如,
coord(ele(4,:),:)=[x1,y1;x2,y2;x3,y3]
是三角形 4 顶点的坐标 (x1,y1)、(x2,y2) 和 (x3,y3)。
我需要绘制的解是一个向量“u”,它的大小是网格的三角形数(=“elem”的行数),因为这个解在每个三角形上都是一个常数。
如何绘制这个不连续的解决方案?