% test of plotyy function, L. Braile, EAS 509, October 16, 2002 % show how plotyy can be used, how to reverse an axis and how % to set the axis limits. % Define two functions x = 0:0.01:20; y1 = 200*exp(-0.05*x).*sin(x); y2 = 0.8*exp(-0.5*x).*sin(10*x); [AX,H1,H2] = plotyy(x,y1,x,y2,'plot'); % the array AX returns "handles" % (identifiers) to the two y axes axes(AX(1)) % select the first y axis (left side) axis([0 20 -200 200]); % set the axis limits set(gca,'YDir','reverse') % reverse the direction of the axis axes(AX(2)) % select the second y axis (right side) axis([0 20 -0.8 0.8]); % set the axis limits