How to create 2-D geometry from a sequence of points in PDE toolbox?
7 views (last 30 days)
Show older comments
MathWorks Support Team
on 5 Apr 2018
Answered: MathWorks Support Team
on 18 Apr 2018
I have a set of (x, y) points in 2D. I want to solve a PDE on the boundary defined by these points. How to create 2-D geometry from this sequence of points in PDE toolbox?
Accepted Answer
MathWorks Support Team
on 5 Apr 2018
Following is one approach to create 2-D geometry from a sequence of points. This will create a closed polygon. This approach can only be used in MATLAB 2018a. This is because prior to 2018a, the function "geometryFromMesh" only accepts 3D points and makes 3D models. In 2018a, this function can also support 2D points creating 2D models.
X = [0 0; 4 0; 8 0; 12 0; 16 0; 16 2; 2 2; 2 3; 8 3; 8 5; 0 5];
pg = polyshape(X(:,1),X(:,2));
plot(pg);
tr = triangulation(pg);
% Create a PEDE Model
pdem = createpde;
% Create the geometry from the triangulatiom
% Some of the intermediate points in the polygon are abstracted away
pdem.geometryFromMesh(tr.Points', tr.ConnectivityList')
pdegplot(pdem,'VertexLabels','on')
In the following link there is another generalized example for creating circle, rectangle, ellipse shaped geometries in the PDE toolbox:
This approach can be followed in releases prior to 2018a as well (verified in 17b).
0 Comments
More Answers (0)
See Also
Categories
Find more on Geometry and Mesh in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!