Extract the longest edge of a mesh generated by pdetool
4 次查看(过去 30 天)
显示 更早的评论
When I generate a mesh with pdetoolbox, like the one in the image. How can I extract the norm (longest edge value) of the mesh? I have been looking for a while, but couldn't find anything helpful.

0 个评论
采纳的回答
Alan Weiss
2018-7-16
编辑:Alan Weiss
2018-7-16
First, export your mesh (I assume that it is a linear mesh) from Mesh > Export Mesh. You get p, e, and t matrices in your workspace.
Then find the lengths of all the triangles in your mesh.
edge1 = p(:,t(1,:)) - p(:,t(2,:)); % point 1 to point 2
edge2 = p(:,t(1,:)) - p(:,t(3,:)); % point 1 to point 3
edge3 = p(:,t(2,:)) - p(:,t(3,:)); % point 2 to point 3
L1 = hypot(edge1(1,:),edge1(2,:)); % Find the lengths
L2 = hypot(edge2(1,:),edge2(2,:));
L3 = hypot(edge3(1,:),edge3(2,:));
Then find the longest of the lengths.
[long1,idx1] = max(L1)
[long2,idx2] = max(L2)
[long3,idx3] = max(L3)
There may be more efficient ways to code this, but I just tried the code I gave and believe that it works.
Alan Weiss
MATLAB mathematical toolbox documentation
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Partial Differential Equation Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!