Iterations of an indirect equation using MATLAB
I am stuck on plotting a graph of surface potential(shy_s) Vs Gate voltage(vgb). I just have to solve this equation below and find the root for every iterations
vgb=vfb+shy_s+gama.*sqrt(shy_s+shy_t.*exp((shy_s-2.*shy_f)/shy_t))
where
shy_f=0.347; %shy_f=shy_t*ln(Na/ni)
shy_t=0.0259; %Thermal voltage = KT/e ; where k = 1.3806*10^-23 @ 300 K
es=11.7*8.85*10^-12;
Na=10^10; %[unit]=[m^-3)
cox=6.93*10^-12; %[unit]=[F/m^2] and t_ox=550 A
q=1.6*10^-19;
vfb=0;
gama=(sqrt(2*q*es*Na)/cox);
Here I have to find the value of shy_s(surface potential)
for different values of vgb(gate voltage)
.
So I tried different methods to solve it, such as
a=zeros(1,100);
b=zeros(1,100);
for vgb=0:0.1:10
shy_s=0;
% Say
p=shy_s;
% And
j=vgb-vfb-((sqrt(2*q*es*10^10))/cox).*sqrt(shy_s+shy_t.*exp((shy_s-2.*shy_f)/shy_t));
D=p-j;
if D>0
for shy_s=0:0.1:30;开发者_Go百科
D=p-j;
if D<0
a=shy_s;
break
end
end
elseif D<0
for shy_s=0:0.1:30
D=p-j;
if D>0
a=shy_s;
break
end
end
end
b(1,vgb)=a;
end
plot(vgb,b)
At this manner the following error shows up:
??? Subscript indices must either be real positive integers or logicals.
Error in ==> shy_s_vs_vgb_latest2 at 78 b(1,vgb)=a;
Again I tried to use rather a simpler technique-
vgb=fzero(@(shy_s)vfb+shy_s+gama.*sqrt(shy_s+shy_t.*exp((shy_s-(2.*shy_f))/shy_t)),2)
but it says-
Exiting fzero: aborting search for an interval containing a sign change because complex function value encountered during search. (Function value at -0.56 is -0.56+62.1585i.) Check function or try again with a different starting value.
vgb =
NaN
Another relation can be used for the same purpose
(vgb-vfb-shy_s)/gama)^2 = shy_s+shy_t.*(exp((shy_s-2*shy_f)/shy_y))+shy_t.*(exp(-shy_s/shy_t)-1)
Although not likely the best solution, a quick and dirty trick is to the following:
opt = optimset('TolFun',1e-8);
vgb=@(shy_s) vfb+shy_s+gama.*sqrt(shy_s+shy_t.*exp((shy_s-2.*shy_f)/shy_t));
b = fminsearch(@(shy_s) abs(vgb(shy_s)-VAL),10,opt);
with VAL
being the number you wish to find the inverse for.
Here how to use the function fzero for a simple iteration with out doing much -
for i=1:length(vgb)
c=@(shy_s)((vgb(i)-vfb-shy_s)/gama)-sqrt(abs(shy_s+shy_t.*exp((shy_s-2.*shy_f)/shy_t)));
shy_s=fzero(c,[-3 10])
a(i)=shy_s
end
- 'a' gives the correct iterated value!
精彩评论