Plot finite element method using Matlab
64 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tingchang Yin
el 17 de Dic. de 2021
Respondida: KSSV
el 17 de Dic. de 2021
Suppose that I have triangular mesh as follows:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/836760/image.jpeg)
and the mesh data structure is like
element = [nodeTag1 nodeTag2 nodeTag3];
coordinate = [x1, y1
x2, y2
x3, y3]; % coordinates of each node
I can use
patch('Vertices', coordinate, 'Faces', element)
to plot the mesh (the above plot).
After FEM analysis, I can get the values at each node (vertices of each triangle), like
data = [p1, p2, p3];
To plot the field, I can use
patch('Vertices', coordinate, 'Faces', element, 'FaceVertexCData', Data, 'FaceColor', 'interp');
to interpolate the values (field) on such a domain, with a colormap, and the results is like the following plot
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/836765/image.jpeg)
My questions are
- If I can only get the values on the each edge of triangles (i.e. centers of edges), how can I plot the result?
- If I can only get the values on the center of triangles, how to plot the result?
Besides, the domain can be very irregular. I am affrid that
contourf
and
meshgrid
are not applicable.
0 comentarios
Respuesta aceptada
KSSV
el 17 de Dic. de 2021
You can interpolate the values to a grid using griddata or scatteredInterpolant. Read about them.
You can also plot contours using the present data. For this refer: https://in.mathworks.com/matlabcentral/fileexchange/38858-contour-plot-for-scattered-data
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!