Imagesc for triangular element

Hi,
I have a plate with mesh of triangular elements. I have specific number for each element. How can I use imagesc to have contourplot of those values? it is different from trisurf function of course?
Thanks

 Accepted Answer

KSSV
KSSV on 4 Feb 2019
YOu can straight away plot contour with your data. Have a look in the following file exchange function: https://in.mathworks.com/matlabcentral/fileexchange/38858-contour-plot-for-scattered-data
If you want to use imagesc you have to convert your unstructured data into structured data either by using scatteredinterpolant or griddata.

7 Comments

Thanks
The problem is my mesh is triangular and not consistently meshed. I mean the numbering of the elements.
So, do scatteredinterpolant or griddat work for this element? assign color for each number.
The triangular element makes it a bit more difficult. Scattered interpolation works on the premise that the data is given for particular points and that there is some smooth transition to the values of other points that are given. Triangular elements, though, assert that the entire area within the triangle has a particular value, so to run a scattered interpolation you first have to subdivide the triangle into a number of sections each of which you approximate point-wise with the given value.
Triangular meshes are frequently used to model stresses and bending. The faces are not necessarily small and localized: they could end up large, or they could end up long and thin.
Depending on what is being modeled, variation in values are sometimes considered to be only along the edges, with the faces being considered to be rigid and inflexible. In such a case, a contour plot must follow edges: if there are two adjacent faces with different values, then a value between the two might not exist at some location between the two that is proportionate to the difference in value: the intermediate values might be considered to all exist simultaneously along the edges.
But there are certainly other cases where the intention is that the triangles are small and that taking them as point sources is fine, in which case plain scattered interpolation might be fine.
Thus we need to know more about the meaning of the triangulation to be sure of offering an appropriate solution.
YOu can starightaway use trisurf if you want to have a color plot. Note that unstructuredgrid is easy to handle and plot.
Torkan
Torkan on 4 Feb 2019
Edited: Torkan on 4 Feb 2019
As I said trisurf is not what I want. For stress distribution it works since I average the elemental stress to the nodes. However, for other parameters which cannot be averaged ( average is meaningless) I need sth like magesc
anyway thanks
YOu can use the tricontour given in the link.
Thanks
So, this function still available in MATLAB right? (2018) since while writing in MATLAB nothing is appeared for help.
Also, it gives us sth like imagesc, right? I mean colormap...
imagesc works on structured grids i.e matrices......tricontour will work....

Sign in to comment.

More Answers (1)

Torkan
Torkan on 4 Feb 2019
walter thank you so much for detail

Tags

Asked:

on 3 Feb 2019

Commented:

on 4 Feb 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!