- 积分
- 26297
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-6-1
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
%构造 x,y1,y2
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
%AX(1)和 AX(2)分别是左右 axes 的句柄,可以用 set()函数处理
[AX,H1,H2] = plotyy(x,y1,x,y2,'plot');
%用 set 函数设置图形是正方形
axis([AX],'square');
%用 set()函数设置坐标轴颜色
set(AX(1),'XColor','k','YColor','b');
set(AX(2),'XColor','k','YColor','r');
%用 set 函数这只 y 坐标轴的范围和 tick 间距
% set(AX(1),'ylim',[-1,1],'ytick',[-1:0.4:1]);
% set(AX(2),'ylim',[0,550],'ytick',[0:50:550]);
%get()函数获得左边的 axes 的 Y 轴标注
HH1=get(AX(1),'Ylabel');
%用 set()函数设置左边的 axes 的 Y 轴标注内容和颜色
set(HH1,'String','Left Y-axis');
set(HH1,'color','b');
%get()函数获得右边的 axes 的 Y 轴标注
HH2=get(AX(2),'Ylabel');
%用 set()函数设置右边的 axes 的 Y 轴标注内容和颜色
set(HH2,'String','Right Y-axis');
set(HH2,'color','r');
%H1 和 H2 为左右两个曲线的句柄,可以用 set 函数设置
set(H1,'LineStyle','-');
set(H1,'color','b');
set(H2,'LineStyle',':');
set(H2,'color','r');
%标注曲线名称
legend([H1,H2],{'y1';'y2'});
%标注 x 轴和标题
xlabel('Zero to 20 musec.');
title('Labeling plotyy');
plotyy使用编程实例.pdf
(179.69 KB, 下载次数: 44)
|
评分
-
查看全部评分
|