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.

采纳的回答

Alan Weiss
Alan Weiss 2018-7-16
编辑:Alan Weiss 2018-7-16
You can extract the information yourself from the Mesh Data.
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 个)

类别

Help CenterFile Exchange 中查找有关 Partial Differential Equation Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by