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

 채택된 답변

KSSV
KSSV 2019년 2월 4일

1 개 추천

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

Torkan
Torkan 2019년 2월 4일
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.
Walter Roberson
Walter Roberson 2019년 2월 4일
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.
KSSV
KSSV 2019년 2월 4일
YOu can starightaway use trisurf if you want to have a color plot. Note that unstructuredgrid is easy to handle and plot.
Torkan
Torkan 2019년 2월 4일
편집: Torkan 2019년 2월 4일
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
KSSV
KSSV 2019년 2월 4일
YOu can use the tricontour given in the link.
Torkan
Torkan 2019년 2월 4일
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...
KSSV
KSSV 2019년 2월 4일
imagesc works on structured grids i.e matrices......tricontour will work....

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Torkan
Torkan 2019년 2월 4일

0 개 추천

walter thank you so much for detail

태그

질문:

2019년 2월 3일

댓글:

2019년 2월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by