identifying the corresponding node number to each element for meshed geometry.

5 views (last 30 days)
i used a triangular geometric order to mesh the geometry i have. but i need a matrix of the element and node number associated with it . how can i do that? for example if element 1 is bounded by node 1,2 and 3; and also element 2 is bounded by 2, 3 and 4 node numbers.....i need the matrix be like [1 2 3;2 3 4]..................................

Answers (1)

Prateekshya
Prateekshya on 11 Oct 2024
Hello Mekdes,
To create a connectivity matrix for a triangular mesh in MATLAB, where each row represents an element and the columns represent the node numbers that form the vertices of the triangle, you can follow these steps:
  • Mesh Generation: If you haven't already generated the mesh, you can use MATLAB functions like delaunayTriangulation to create a triangular mesh from a set of points.
  • Extract Connectivity List: Once you have the mesh, you can extract the connectivity list that describes which nodes form each element.
Here is a sample code for the same:
% Define your node coordinates (example)
nodes = [
0, 0; % Node 1
1, 0; % Node 2
1, 1; % Node 3
0, 1 % Node 4
];
% Generate a Delaunay triangulation
dt = delaunayTriangulation(nodes);
% Extract the connectivity list
connectivityMatrix = dt.ConnectivityList;
% Display the connectivity matrix
disp('Connectivity Matrix:');
disp(connectivityMatrix);
  • Custom Mesh: If you have a custom mesh generation process, ensure you have the node coordinates and the logic to determine which nodes form each triangle. You can manually create the connectivity matrix based on your mesh generation logic.
  • Advanced Usage: If you are using a more sophisticated meshing tool or library, refer to its documentation for extracting the connectivity matrix. Many FEM toolboxes and mesh libraries have built-in functions for this purpose.
I hope this helps!

Community Treasure Hunt

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

Start Hunting!