- Identify the Inner Circle Elements: Determine which elements (triangles) belong to the inner circle.
- Plot the Mesh: Use the patch function to plot the mesh and fill the inner circle.
How to fill a triangle in an circular mesh in pdeplot?
2 views (last 30 days)
Show older comments
Hello sir
I have an circular mesh. Inside the mesh I have another circle.Now how to fill the circle? In the circle there are 4 triangle element and the cicular mesh have 268 elements. Please help me.
0 Comments
Answers (1)
AKennedy
on 2 Jan 2025
From what you have described, here's how I would approach it
% Sample data: Adjust these arrays based on your actual mesh data
% Nodes of the mesh (example coordinates)
nodes = [
0, 0;
1, 0;
0.5, 0.5;
0, 1;
% ... (add more nodes as needed)
];
% Connectivity of the mesh elements (example indices)
elements = [
1, 2, 3;
1, 3, 4;
% ... (add more elements as needed)
];
% Elements belonging to the inner circle
inner_circle_elements = [1, 2, 3, 4]; % Example indices of inner circle elements
% Plot the full mesh
figure;
hold on;
for i = 1:size(elements, 1)
% Extract node indices for the current element
node_indices = elements(i, :);
% Get the coordinates for the nodes of the element
x = nodes(node_indices, 1);
y = nodes(node_indices, 2);
% Plot the element
patch(x, y, 'w'); % 'w' for white; adjust color as needed
end
% Fill the inner circle elements
for i = inner_circle_elements
% Extract node indices for the current inner circle element
node_indices = elements(i, :);
% Get the coordinates for the nodes of the element
x = nodes(node_indices, 1);
y = nodes(node_indices, 2);
0 Comments
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!