分享

转载:MATLAB关于plotyy函数的使用三例

 昵称31871414 2016-06-15

一、线型设置:

转载:MATLAB关于plotyy函数的使用三例
% 程序1. 线型设置:
t=0:.1:8;
[ax,h1,h2]=plotyy(t,sin(t),t,cos(t));
set(h1,'linestyle','-','marker','o','color','r');
set(h2,'linestyle',':','marker','x','color','b');

%=========================================================

二、加注图例:
转载:MATLAB关于plotyy函数的使用三例

% 程序2.加注图例:
x=linspace(0,2*pi,40);
[ax,h1,h2]=plotyy(x,sin(x)+cos(x),x,exp(x));

set(h1,'linestyle','-')
set(h2,'linestyle','-')
set(h1,'marker','o')
set(h2,'marker','+')
hold on
x=linspace(0,2*pi,40);
hh=line(x,cos(x));
set(hh,'linestyle','-')
set(hh,'marker','s')

hold on
hhf=line(x,sin(x));
set(hhf,'color','r')
set(hhf,'linestyle','-')
set(hhf,'marker','*')
legend([h1,h2,hh,hhf],'sin(x)+cos(x)','exp(x)','cos(x)','sin(x)',0);

%========================================================

三、坐标轴标注:
转载:MATLAB关于plotyy函数的使用三例
% 程序3.坐标轴标注:
figure;
t=0:.1:3*pi;
[H,Ha,Hb]=plotyy(t,sin(t),t,exp(t));
d1=get(H(1),'ylabel');
set(d1,'string','yayacpf');
d2=get(H(2),'ylabel');
set(d2,'string','bbs from hit','fontsize',18);
%============================================

From: http://www./blog/html/11/317611-13768.html

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约