www.gusucode.com > symbolic 源码程序 matlab案例代码 > symbolic/ImproveAppearanceOfSurfacePlotExample.m

    %% Improve Appearance of Surface Plot
% Plot the expression |f|. Improve the appearance of
% the surface plot by using the properties of the handle returned by
% |fsurf|, the lighting properties, and the |colormap|. 
% 
% Create a light by using |camlight|. Increase brightness by using |brighten|. 
% Remove the lines by setting |EdgeColor| to |'none'|.
% Increase the ambient light using
% |AmbientStrength|. For details, see <docid:matlab_visualize.f1-21767>. Turn
% the axes box on. For the title, convert |f| to LaTeX using |latex|. Finally, to
% improve the appearance of the axes ticks, axes labels, and title, set 
% |'Interpreter'| to |'latex'|.
syms x y
f = 3*(1-x)^2*exp(-(x^2)-(y+1)^2)... 
   - 10*(x/5 - x^3 - y^5)*exp(-x^2-y^2)... 
   - 1/3*exp(-(x+1)^2 - y^2);
h = fsurf(f,[-3 3]);

camlight(110,70)
brighten(0.6)
h.EdgeColor = 'none';
h.AmbientStrength = 0.4;

a = gca;
a.TickLabelInterpreter = 'latex';
a.Box = 'on';
a.BoxStyle = 'full';

xlabel('$x$','Interpreter','latex')
ylabel('$y$','Interpreter','latex')
zlabel('$z$','Interpreter','latex')
title_latex = ['$' latex(f) '$'];
title(title_latex,'Interpreter','latex')