MATLAB作图:plotyy使用方法。即:横坐标相同,纵坐标不同的两条曲线画在同一图上进行比对。
例1. 需要采用图形句柄,详细内容参考MATLAB帮助文件有关plotyy的例程
%%This example graphs two mathematical functions using plot as the
plotting function. The two y-axes
%%enable you to display both sets of data on one graph even though
relative values of the data are quite
%%different.
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');
用[AX,H1,H2]=plotyy(x,y1,x,y2);命令。AX(1),AX(2)分别为左右Y轴的句柄
%%You can use the handles returned by plotyy to label the axes and
set the line styles used for plotting.
%%With the axes handles you can specify the YLabel properties of
the left- and right-side y-axis:
set(get(AX(1),'Ylabel'),'String','Slow Decay')