"Owen " <owen.daniel@removethis.warwick.ac.uk> wrote in message <gpeeq9$e07$1@fred.mathworks.com>...
> Hi there.
> I want to write an Mfile which will output a diagram showing the nth Barycentric Subdivision (BCS) of the unit triangle in R^2.
>
> By the nth BCS I mean: divide the triangle into its BCS. Then divide all the subtriangles in the triangulation by their own BCS.
>
> The following may be helpful if unfamiliar with BCS,
>
> wikipedia entry 
> http://en.wikipedia.org/wiki/Barycentric_subdivision
>
> diagram of the divisions for n = 1,2,3,4 
> http://www.math.vt.edu/people/floyd/coloring/barycent.pdf
> .......
The figures in "barycent.pdf" do not look like true barycentric subdivisions to me, from n = 2 case on. In the Wikipedia reference you also gave, they state: "The BCS of a triangle S divides it into six triangles; each part has one vertex v2 at the barycenter of S, another one v1 at the midpoint of some side, and the last one v0 at one of the original vertices." The figures shown in "barycent.pdf" do not divide the triangle sides at their midpoints nor do they meet at the barycenter  far from it! At n = 4 each side of the original triangle ought to have been divided into 16 equal segments and that certainly isn't true of the figure shown for the 4th BCS.
On the possibility that these pdf figures do not represent what you actually want, here is some code that plots the nth barycentric subdivision of the original triangle, as I understand the concept.
n = 4; % < Set n to the desired depth of subdivision
M = [1/2,sqrt(3)/6,0,sqrt(3)/3,1/2,sqrt(3)/6]; % First triangle
for k = 1:n
t1 = M(:,1:2); t2 = M(:,3:4); t3 = M(:,5:6);
t12 = [(M(:,1)+M(:,3))/2,(M(:,2)+M(:,4))/2];
t23 = [(M(:,3)+M(:,5))/2,(M(:,4)+M(:,6))/2];
t31 = [(M(:,5)+M(:,1))/2,(M(:,6)+M(:,2))/2];
t123 = [(M(:,1)+M(:,3)+M(:,5))/3,(M(:,2)+M(:,4)+M(:,6))/3];
M = [t123,t1,t12;t123,t12,t2;t123,t2,t23; ...
t123,t23,t3;t123,t3,t31;t123,t31,t1];
end
m = size(M,1);
hold on
for k = 1:m
plot(M(k,[1 3 5 1]),M(k,[2 4 6 2]),'y')
end
axis equal
hold off
M will be an m x 6 array in which each row represents the three vertices of a subdivision triangle, the first two elements, the second two, and the third two being the x and y pair of coordinates of the respective vertices. For the n = 4 case there should be m = 1296 rows in M.
Roger Stafford
