%画出双坐标图并对属性进行处理
len=numel(ut);
Xs=0;
Xl=len;%设置X轴的范围
Ys=3;
Yl=4.3;%设置Y轴的范围
Y2s=-1;
Y2l=2;%设置第二个Y轴的范围
h_ap=axes('Position',[0.1,0.1,0.8,0.8]);%控制图片占比
set(h_ap,'Xcolor','k','Ycolor','k','Xlim',[Xs,Xl],'Ylim',[Ys,Yl]);
nx=5;%x轴的刻度间隔5等分
ny=5;
pxtick=(Xs:((Xl-Xs)/nx):Xl);
pytick=Ys:((Yl-Ys)/ny):Yl;
set(h_ap,'Xtick',pxtick,'Ytick',pytick,'Xgrid','off','Ygrid','off')
%set(h_ap,'Xticklabel',{'0','6000','12000','18000','24000','30000'}); %设置刻度的显示内容
h_linet=line(1:len,ut,'Color','b');
set(get(h_ap,'Xlabel'),'String','Time(s)','FontName','Times New Roman','FontSize',10,...
'FontWeight','bold','FontAngle','normal');%设置坐标轴刻度字体名称,大小
set(get(h_ap,'Ylabel'),'String','Ut(V)','FontName','Times New Roman','FontSize',10,...
'FontWeight','bold','FontAngle','normal');
h_at=axes('Position',get(h_ap,'Position')); %在相同位置新建一个轴
set(h_at,'Color','none','Xcolor','k','Ycolor','k'); %轴的颜色是黑色
set(h_at,'Xaxislocation','bottom');
set(h_at,'Yaxislocation','right','Ydir','normal') %
set(h_at,'Xtick',pxtick);%设为相同的X刻度间隔
%set(h_at,'Xticklabel',{'0','6000','12000','18000','24000','30000'}); %设置刻度的显示内容
%set(get(h_at,'Ylabel'),'String','It(A)','FontName','Times New Roman','FontSize',10,...
%'FontWeight','bold','FontAngle','normal');
set(h_at,'Ylim',[Y2s,Y2l]) %
set(h_at,'Xlim',[Xs,Xl]) %
hlineI=line(1:len,it,'Color','r','Parent',h_at);%画线
%hlegend= legend(h_ap, [h_linet hlineI], 'Ut', 'It', 0); %为两条曲线创建图例
%set(hlegend,'Box','off');