SURF and face color on the boundaries



Hi!

I am using SURF to present surface Z(x,y). I have a problem with faces
that connect object boundary points with the background.

For example:
--------------
Z = membrane;
[h,w] = size(Z);
[X,Y] = meshgrid(1:h,1:w);
mask = Z~=0;

figure
surf(X',Y',Z) , title('points on the boundaries connected to the zero
points on the bg')

figure
surf(X'.*mask,Y'.*mask,Z), title('points on the boundaries connected to
one point')
-----------------

Both plots are not as I wish them to be:
I don't want to see on the plot the faces that connect boundary points
to the backgroud. also, I would that faces+points+egdes that are not in
mask be invisible.

Is it possible to achieve?

Important to mention, I do not have the true faces, only the surface Z.


Thanks!
-kem

.