【问题标题】:Extract the longest edge of a mesh generated by pdetool提取由 pdetool 生成的网格的最长边
【发布时间】:2018-07-16 01:26:34
【问题描述】:

当我使用 pdetoolbox 生成网格时,就像图像中的那个。如何提取网格的范数(最长边值)?我尝试阅读“pdetool”的文档,并在“FEMesh 属性”中找到了“MaxElementSize”属性。虽然我不知道如何在 PDE Toolbox GUI 中使用“MaxElementSize”。

【问题讨论】:

  • 您好,贡萨洛,欢迎来到 SO。您能否提供更多关于您迄今为止尝试过的内容以及为什么它没有奏效的详细信息。 stackoverflow.com/help/how-to-ask
  • @TimOgilvy 好的,我尝试添加更多信息

标签: matlab mesh pde


【解决方案1】:

从工具箱菜单中,选择Mesh,然后选择Export Mesh

然后您可以选择更改变量名称。这里重要的是前两个,即 pointsedges 的名称。在此示例中,我将它们保留为默认值,即 p 用于 pointse 用于 edges

points 是一个 2*n 矩阵,每一列代表一个顶点的 X 坐标和 Y 坐标。 e 是一个 7*n 的矩阵,每一列都是构造边的参数。前两行是边的顶点的索引,其余的在这里不感兴趣。

% Each edge is bounded by two vertices. 
% Extract the coordinates of the first set of vertices.
e1 = p(:,e(1,:)); 
% Extract the coordinates of the second set of vertices.
e2 = p(:,e(2,:));
% Calculate the square distance.
dsqr = sum((e1 - e2).^2);
% Take the maximum.
[dsqrMax, idx] = max(dsqr);
% Length of the longest edge
dMax = sqrt(dsqrMax);

idxe 矩阵中最长边的索引。可以通过e(:,idx);提取边缘的所有信息。

【讨论】:

  • 非常感谢,这正是我要找的 :)
猜你喜欢
  • 1970-01-01
  • 2012-01-03
  • 1970-01-01
  • 2012-12-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多