Index: /issm/trunk/src/m/classes/public/extrude.m
===================================================================
--- /issm/trunk/src/m/classes/public/extrude.m	(revision 511)
+++ /issm/trunk/src/m/classes/public/extrude.m	(revision 512)
@@ -48,9 +48,11 @@
 thickness3d=md.thickness; %thickness and bed for these grids
 bed3d=md.bed;
+
 %Create the new layers
-for i=2:numlayers,
-	x3d=[x3d; md.x]; %build the grids of the other layers
+for i=1:numlayers-1,
+	x3d=[x3d; md.x]; 
 	y3d=[y3d; md.y];
-	z3d=[z3d; bed3d+thickness3d*(i/numlayers)^extrusionexponent]; %grids are distributed between bed and surface accordingly to the given exponent
+	%grids are distributed between bed and surface accordingly to the given exponent
+	z3d=[z3d; bed3d+thickness3d*(i/(numlayers-1))^extrusionexponent]; 
 end
 number_grids3d=size(x3d,1); %number of 3d grids for the non extruded part of the mesh
