function [TR] = uniform_grid(n) % Returns uniform triangulation of unit square [X,Y] = meshgrid(0:1/n:1,0:1/n:1); X = reshape(X,[],1); Y = reshape(Y,[],1); % we have a vector of X- and Y- coordinates of our vertices P = [X,Y]; % here it would be better to construct the connectivity matrix by hand! % the usage below is to indicate how this can be done for an arbitrary % collection of points T = delaunay(X,Y); TR = triangulation(T,P); triplot(TR)