# Creating a 2D mesh on a given boundary

29 visualizzazioni (ultimi 30 giorni)
Fabrizio Bernardi il 14 Ott 2021
Hello, I wanted to ask how to create a triangular mesh in a delimited region. I have a vector of points x and y delimiting all the point, I constructed the region boundary using
k = boundary(x,y);
and I can see the plot of my boundary with
plot(x(k),y(k));
How do i create a triangular mesh of a specific h size covering this region?
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Pavan Guntha il 22 Ott 2021
Hi,
You could use 'triplot' function with an appropriate triangulation object to plot the triangular mesh. An illustration on how can we draw a triangular mesh onto a random shape is shown below:
P = rand(10,2);
K = boundary(P(:,1), P(:,2));
plot(P(K,1), P(K,2))
T = delaunayTriangulation(P);
triplot(T)
The random shape & triangular mesh are as follows:
• triplot - Used to plot a 2D triangular mesh based on the input x,y co-ordinates & a triangulation object.
• delaunayTriangulation - We can specify few edge constraints on how a triangulation object is to be created based on which the triangular mesh is plotted.
Hope this helps!
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Fabrizio Bernardi il 25 Ott 2021
Thank you very much! Very helpful :)

Accedi per commentare.

### Categorie

Scopri di più su Surface and Mesh Plots 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!

Translated by