function tetrahedron(Z,P);
load tetcoor;
figure;
hold on;
h = plot3(Z(find(P==1),1),Z(find(P==1),2),Z(find(P==1),3),'k.');set(h,'MarkerSize',1);
h = plot3(Z(find(P==2),1),Z(find(P==2),2),Z(find(P==2),3),'r.');set(h,'MarkerSize',1);
h = plot3(Z(find(P==3),1),Z(find(P==3),2),Z(find(P==3),3),'g.');set(h,'MarkerSize',1);
h = plot3(Z(find(P==4),1),Z(find(P==4),2),Z(find(P==4),3),'b.');set(h,'MarkerSize',1);
line([0 tetcoor(1,1)],[0 tetcoor(1,2)],[0 tetcoor(1,3)])
line([0 tetcoor(2,1)],[0 tetcoor(2,2)],[0 tetcoor(2,3)])
line([0 tetcoor(3,1)],[0 tetcoor(3,2)],[0 tetcoor(3,3)])
line([0 tetcoor(4,1)],[0 tetcoor(4,2)],[0 tetcoor(4,3)])
view([55 6]);

