%% Change Alphamap for Surface Plot
% Create a surface plot and change the alphamap.

% Copyright 2015 The MathWorks, Inc.


[x,y] = meshgrid([-2:.2:2]);
z = x.*exp(-x.^2-y.^2);
%%
% Plot the data, using the gradient of |z| as the alphamap.

figure
surf(x,y,z+.001,'FaceAlpha','flat',...
    'AlphaDataMapping','scaled',...
    'AlphaData',gradient(z),...
    'FaceColor','blue')

%%
% Change the alphamap to be opaque at the middle and transparent towards
% the ends.
alphamap('vup')