Plot frame problem while using hold function
7 views (last 30 days)
Show older comments
Hello guys,
I notice that when i am using hold function, the frame around my plot disappears on top and on right side, and dont know how to avoid these while i am using the hold function.
Code source:
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
Accepted Answer
Mischa Kim
on 25 Nov 2014
Edited: Mischa Kim
on 25 Nov 2014
ApolloPT, just swap these two lines:
h=plot(VD1,ID1_sqrt,'LineWidth',2,'color',cor);
hold on;
in other words
h=plot(VD1,ID1_sqrt,'LineWidth',2,'color',cor);
hold on;
plot(VD1,rect,'LineStyle','--','LineWidth',1,'color',get(h,'color'));
hold off;
More Answers (0)
See Also
Categories
Find more on Electromechanical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!