在matlab中使用hold函数绘制框架

在matlab中使用hold函数绘制框架,matlab,plot,Matlab,Plot,我注意到,当我使用hold函数时,绘图周围的框架在顶部和右侧消失,并且在使用hold函数时不知道如何避免这些 代码来源: kD1=[ -1.000 -08.2285E-09 -0.500 -02.7071E-09 -0.000 +03.2488E-09 0.500 +07.3502E-09 1.000 +17.5158E-09 1.500 +0.25626E-06 2.000 +0.64422E-06 2.500 +1.34482E-06 3.000 +02.

我注意到,当我使用hold函数时,绘图周围的框架在顶部和右侧消失,并且在使用hold函数时不知道如何避免这些

代码来源:

kD1=[
 -1.000  -08.2285E-09
 -0.500  -02.7071E-09
 -0.000  +03.2488E-09
 0.500  +07.3502E-09
 1.000  +17.5158E-09
 1.500  +0.25626E-06
 2.000  +0.64422E-06
 2.500  +1.34482E-06
 3.000  +02.8521E-06
];
VD1=kD1(:,1);
ID1=kD1(:,2);
 for i=1:length(kD1)
    test1(i,1)=sqrt(ID1(i,1));
 end
 ID1_sqrt=test1(:,1);
 %% Slope Function to Determine Vth (Threshold Voltage)
 index=length(kD1);
 a=0.7;
 b=a*index; 
 x1=VD1(int32(b),1);
 y1=ID1_sqrt(int32(b),1);
 x2=VD1(index,1);
 y2=ID1_sqrt(index,1);
 m=(y2-y1)/(x2-x1);
 b=y2-m*x2;
 for i=1:index
        rect(i,1)=m*VD1(i,1)+b;
 end
 Vth=-b/m;
 %%
 %cor do gráfico
 cor='b';
 figure('units','normalized','outerposition',[0 0 1 1])
 hold on;
 h=plot(VD1,ID1_sqrt,'LineWidth',2,'color',cor);
 plot(VD1,rect,'LineStyle','--','LineWidth',1,'color',get(h,'color'));
 hold off;
 text(0.1,1.6*10^-3,'Vth= ','Color',get(h,'color'),'FontSize',13);
 text(0.3,1.6*10^-3,num2str(Vth),'Color',get(h,'color'));
 yLimit = get(gca,'YLim');
 line([0 0],yLimit,'Color','k','LineStyle',':');
 %%
 xlabel('Gate Voltage Vg (V)');
     h = get(gca, 'xlabel');
     set(h, 'FontSize', 20)
 ylabel('\surdDrain-Source Current (A)');
    f = get(gca, 'ylabel');
    set(f, 'FontSize', 20)
axis('square');
axis([-inf inf ID1_sqrt(1) ID1_sqrt(length(ID1_sqrt))])
set(gcf,'color','w');
    %trick
    yt = get(gca,'YTick');
    set(gca,'YTickLabel', sprintf('%.1f|',yt/10^-4))
    set(gca, 'LineWidth', 2); 
    set(gca, 'FontSize', 11);
    clear
持有:
不保留:

如果您发现帧消失,可以添加命令框使帧重新出现。

我刚想出来,必须这样放置:

h=plot(VD1,ID1_sqrt,'LineWidth',2,'color',cor); 
hold on; 
plot(VD1,rect,'LineStyle','--','LineWidth',1,'color',get(h,'color')); 
hold off;

我刚想出来,它必须这样放置:h=plotVD1,ID1_sqrt,'LineWidth',2,'color',cor;等等plotVD1,rect,'LineStyle','-','LineWidth',1,'color',geth,'color';拖延;嗨,法比奥,欢迎来到StackOverflow。看来你已经找到解决问题的方法了?如果是这样的话,请把它作为你问题的答案而不是像你那样的评论,并将其标记为接受答案。这样,你将帮助将来可能有同样问题的其他人。