Prev: Reading generic msh file
Next: rescaling for fmincon
From: Ross Anderson on 28 Jul 2010 14:44 Hi all, I'm solving a PDE on a mesh. The mesh is of the format similar to the results of DelaunayTri, but I'm dealing with both triangles and quadrangles. So dt.Quadrangulation holds a list of vertices for each quadrangle/triangle. Triangles pad the last vertice with NaN. dt.X holds coordinates. Example (try running it to visualize): dt.Quadrangulation = [ 4 10 2 11 4 11 1 NaN 5 14 2 10 5 16 6 14 6 3 15 NaN 7 8 13 NaN 7 13 4 NaN 8 16 5 12 8 17 6 16 9 6 17 NaN 9 17 8 NaN 11 2 1 NaN 12 5 10 4 13 8 12 4 14 6 15 2 15 3 2 NaN]; dt.X = [-1.0000 -1.0000 -1.0000 0 -1.0000 1.0000 0 -1.0000 0 0 0 1.0000 1.0000 -1.0000 1.0000 0 1.0000 1.0000 -0.2929 -0.2929 -0.7071 -0.7071 0.2929 -0.2929 0.7071 -0.7071 -0.2929 0.2929 -0.7071 0.7071 0.2929 0.2929 0.7071 0.7071]; patch('faces',dt.Quadrangulation, 'vertices', dt.X, 'FaceColor','r'); After solving the pde, each polygon has an associated value of the average of the function u over that shape, u(i) where the i'th u is the value for the ith shape. Example u=[0.12 0 0.14 0.14 0 0 0 0.14 0.12 0 0 0 0.14 0.12 0.12 0]'; patch('faces',dt.Quadrangulation, 'vertices', dt.X, 'FaceVertexCData',u,'FaceColor','flat'); I can refine the mesh and gain many more cells, but no matter how many I have, I'm usually left with a funky-shaped mesh. I'd like to find a way to smooth my surface out as much as possible while still retaining the averages of the cells. If I translate the values of the cells to the vertices then patch() with FaceColor=interp, it's a little better but still not smooth. One idea is to somehow sample the colors from the interpolated patch onto a mesh then smooth those, but the returned object handle doesn't seem to give access to these interpolated colors, only vertices Perhaps you know of an alternative way to smooth my result while keeping cell averages?
From: Ross Anderson on 28 Jul 2010 15:21 I asked too soon... help isocolors :)
|
Pages: 1 Prev: Reading generic msh file Next: rescaling for fmincon |