MATLAB: How to find the number of triangles formed in below code

cell methodfemtriangles

[x,y] = meshgrid(1:15,1:15); tri = delaunay(x,y); trimesh(tri,x,y)

Best Answer

What does this tell you?
size(tri,1)
Even simpler is to recognize that this is a rectangular grid, of size 15x15, so a lattice with 14x14=196 squares in it. Each square ill be split into two triangles.
14*14*2
ans =
392
In some cases, delaunay had the tendency to generate spurious triangles along the edge of such a domain, but with zero area. I think this is no longer as much of a problem, although with a slightly concave domain, that will still happen, for good reason.