matlab怎样做出双坐标,matlab中双坐标轴的画法

  • Post author:
  • Post category:其他


matlab中双坐标轴的画法

例一:

[AX, H1, H2]=plotyy(n,l,n,s):figure(gcf);

set(H1,’Marker’,’*’);

set(H2,’Marker’,’o’);

legend([H1,H2],’XXXX’,’YYYY’);

例二:

clc

clear all

close all

runoff=[10700 11400 15800 22900 43100 40700 50500 46000 41800

35000];

sed=[0.105 0.094 0.156 1.264 0.363 0.429 0.731 0.682 0.654 0.290];

m=1:10;

[ax,h1,h2]=plotyy(m,runoff,m,sed); %h– line handle

set(get(ax(1),’Ylabel’),’string’,’Runoff (m^3/s))’,’color’,’r’)

%y1

set(get(ax(2),’Ylabel’),’string’,’Sediment concentration

(kg/m^3)’,’color’,’k’) %y2

xlabel(‘Month’)

set(h1,’linestyle’,’-‘,’color’,’r’); set(h2,’lines