www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/IncludeSpecialCharactersInAxisLabelsExample.m

    %% Include Special Characters in Axis Labels
% This example shows how to add axis labels with superscripts and Greek
% symbols. To display superscripts and subscripts, use the characters "^" and "_",
% respectively. To display Greek symbols, use the TeX markup. MATLAB(R) interprets
% characters immediately following the backslash, "\", as TeX characters.

% Copyright 2015 The MathWorks, Inc.



%%
% Create a plot and label the _x_-axis and _y_-axis. Use the TeX markup,
% \pi, to display the Greek symbol $\pi$.  

figure
x = linspace(0,2*pi);
y = exp(0.1*x).*sin(x.^2);
plot(x,y)

xlabel('x = 0 to 2\pi')
ylabel('y = e^{0.1x} sin(x^2)')


%%
% The superscript character, "^", modifies the character immediately
% following it. Display multiple characters in the superscript by including
% them in curly braces.