Extract the longest edge of a mesh generated by pdetool
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Gonzalo Benavides
il 16 Lug 2018
Modificato: Alan Weiss
il 16 Lug 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.

0 Commenti
Risposta accettata
Alan Weiss
il 16 Lug 2018
Modificato: Alan Weiss
il 16 Lug 2018
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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Partial Differential Equation Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!