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

    %% Add Title and Axis Labels
% Plot two data sets using a graph with two _y_-axes. Add a title and axis
% labels.

% Copyright 2015 The MathWorks, Inc.


x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);

figure % new figure
[hAx,hLine1,hLine2] = plotyy(x,y1,x,y2);

title('Multiple Decay Rates')
xlabel('Time (\musec)')

ylabel(hAx(1),'Slow Decay') % left y-axis 
ylabel(hAx(2),'Fast Decay') % right y-axis