1、plotyy函数,用于在一个图中绘制多条2D图形的一个非常常用的函数。有多种格式,下面将给出一般的使用规范。

3、增加标题和y轴标签x = 0:0.01:20;y1 = 200*exp(-0.05*x).*sin(x);y2 = 0.8*exp(-0.5*x).*sin(10*x);figure % newfigure[hAx,hLine1,hLine2] = plotyy(x,y1,x,y2);title('Multiple Decay Rates')xlabel('Time (\musec)')ylabel(hAx(1),'Slow Decay') % left y-axisylabel(hAx(2),'Fast Decay') % right y-axis

5、将两种不同的线型绘制在一起x = 0:0.1:10;y1 = 200*exp(-0.05*x).*sin(x);y2 = 0.8*exp(-0.5*x).*sin(10*x);figureplotyy(x,y1,x,y2,'plot','stem')
