Extract the longest edge of a mesh generated by pdetool

4 visualizaciones (últimos 30 días)
Gonzalo Benavides
Gonzalo Benavides el 16 de Jul. de 2018
Editada: Alan Weiss el 16 de Jul. de 2018
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.

Respuesta aceptada

Alan Weiss
Alan Weiss el 16 de Jul. de 2018
Editada: Alan Weiss el 16 de Jul. de 2018
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

Más respuestas (0)

Categorías

Más información sobre Partial Differential Equation Toolbox 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!

Translated by