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

    %% Use Right y-Axis for Two Data Sets
% Plot three data sets using a graph with two _y_-axes. Plot one set of data associated with the left
% _y_-axis. Plot two sets of data associated with the right _y_-axis by using
% two-column matrices.

% Copyright 2015 The MathWorks, Inc.


x = linspace(0,10);
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
y3 = 0.2*exp(-0.5*x).*sin(10*x);

figure
[hAx,hLine1,hLine2] = plotyy(x,y1,[x',x'],[y2',y3']);