plotyy.txt

来自「在写SSI算法的时候」· 文本 代码 · 共 31 行

TXT
31
字号
clf;
dx=0.1;
x=0:dx:4;
y=x.*sin(x);
s=cumtrapz(y)*dx; 
[AX,H1,H2]=plotyy(x,y,x,s);
set(get(AX(1),'Ylabel'),'String','Left Y-axis','color','k','linewidth',1.2)
set(get(AX(2),'Ylabel'),'String','Right Y-axis','color','r','linewidth',1.2)
set(H1,'LineStyle','--','color','k','linewidth',1.2)
set(H2,'LineStyle',':','color','r','linewidth',1.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); 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?