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

    %% Add Title and Axis Labels
% Use the |linspace| function to define |x| as a vector of 150 values
% between 0 and 10. Define |y| as cosine values of |x|.

% Copyright 2015 The MathWorks, Inc.


x = linspace(0,10,150);
y = cos(5*x);

%%
% Create a 2-D line plot of the cosine curve. Change the line color to a
% shade of blue-green using an RGB color value. Add a title and axis labels to
% the graph using the |title|, |xlabel|, and |ylabel| functions.
figure
plot(x,y,'Color',[0,0.7,0.9])

title('2-D Line Plot')
xlabel('x')
ylabel('cos(5x)')