Matalb 2012 compatibility how to tun Matlab 2015 code at Matlab 2012

2 次查看(过去 30 天)
I had a code for Matlab 2015 version for some reason I have to run it at Matlab 2012 Version but when I ran this code Matlab 2012 version gives errors
can someone provide an alternate way for executing this code at Matlab 2012 version also for double integration please don't use symbolic toolbox double int command that takes too much time that's why I switched my code for 2015 version
here is the code
%--------Define Constants all are in MKS-------%
%----------in green t1 means thermal voltage 0.02586--------%
clc
q=1.602e-19;
h=8.85e-12;
Eox=3.9*h;
Esi=11.8*h;
Ni=1.1e16;
Na=1e25;
for Vgs=0:0.1:0.5
L=20e-9;
tox=3e-9;
tsi=10e-9;
Vds=1;
Q=-q*Na;
V=Vgs;
t1=0.02586;%thermal voltage in V%
Vbi=0.56;%source side potential%
phi=0;
d1=0;
phi_1=0;
syms x y;
for n=1:1:20
kn=n*pi/L;
X1=((cosh(kn*(tox+tsi-y)))+(cosh(kn*(tox-y))))/(sinh(kn*tsi));
%X_1=((cosh(kn*(tox+tsi-y_1)))+(cosh(kn*(tox-y_1))))/(sinh(kn*tsi));
d2=L*(V*(1-(-1)^n))/((cosh(kn*tox))*pi*n);
d4=1/(kn*Esi*tanh(kn*tsi))+1/(kn*Esi*sinh(kn*tsi))+tanh(kn*tox)/(kn*Eox) ;
d3=Vbi*(1-(- 1)^n)/kn+(Vds*(-1)^(n+1))/kn+Q*(1-(-1)^n)/(Esi*kn*kn*kn);;
for m=1:1:10
k1=(2*m-1)*pi/(2*tox);
A1=V/k1+(sin(k1*tox)*(Vbi-Vgs))/(tox*k1^2);
A2=(V)/k1+(sin(k1*tox)*(Vbi+Vds-Vgs))/(tox*k1^2);
d1=d1+(2*(sin(k1*(tox)))*kn*(A1+A2*((-1)^(n+1)))/(tox*(kn^2+k1^2)));
end
Dsf=((d1+d2-d3))/d4;
phi=phi+2*((sin(kn*x))*X1*Dsf)/(kn*Esi*L);
d1=0;
end
phi1=phi+Vbi+(x/L)*Vds+(Q*(x*L-(power(x,2))))/(2*Esi);
phi1_fcn = matlabFunction(phi1);
int_y = @(x) 1./integral(@(y) exp(phi1_fcn(x,y)./t1), tox,tox+tsi, 'Array',true);
integration = integral(int_y, 0,L)
ue=0.02;
W=1e-6;
ff=W/L;
cons_2=ue*q*t1*W*Ni*(1-exp(-Vds/t1));
Id_double_integration=cons_2/integration;
Id_double_integration_norm=(Id_double_integration)/ff;
disp(Id_double_integration_norm);
Vgs;
end
  2 个评论
Walter Roberson
Walter Roberson 2017-12-28
What problem are you observing? I ran your code unchanged in R2017b and it appears to produce answers.
(Well, to be more accurate, I did not put in the clc from the beginning, as you should seldom erase the screen since the user might have put useful information on the screen that they need for various reasons.)
NILESH PANDEY
NILESH PANDEY 2017-12-28
编辑:NILESH PANDEY 2017-12-28
Matlab 2012 giving the these errors for above code as
Error using integralParseArgs (line 12)
Argument 'Array' did not match any valid parameter of the parser.
Error in integral (line 88)
opstruct = integralParseArgs(varargin{:});
Error in @(x)1./integral(@(y)exp(phi1_fcn(x,y)./t1),tox,tox+tsi,'Array',true)
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 133)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 76)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 89)
Q = integralCalc(fun,a,b,opstruct);
Is Matlab 2012 version won't be able to run above code? if not then is there any other way to execute the above code without taking so much time
I was using this code for Matlab 2012 version
clc
%--------Define Constants all are in MKS-------%
q=1.602e-19;
h=8.85e-12;
Eox=3.9*h;
Esi=11.8*h;
Ni=1.1e16;
Na=1e16;
Vgs=0.4;
L=36e-9;
tox=3e-9;
tsi=10e-9;
Vds=1;
Q=-q*Na;
V=Vgs;
t1=0.02586;%thermal voltage in V%
Vbi=0.56;%source side potential%
phi=0;
d1=0;
syms x y;
for n=1:1:20
kn=n*pi/L;
X1=((cosh(kn*(tox+tsi-y)))+(cosh(kn*(tox-y))))/(sinh(kn*tsi));
d2=L*(V*(1-(-1)^n))/((cosh(kn*tox))*pi*n);
d4=1/(kn*Esi*tanh(kn*tsi))+1/(kn*Esi*sinh(kn*tsi))+tanh(kn*tox)/(kn*Eox) ;
d3=Vbi*(1-(- 1)^n)/kn+(Vds*(-1)^(n+1))/kn+Q*(1-(-1)^n)/(Esi*kn*kn*kn);;
for m=1:1:10
k1=(2*m-1)*pi/(2*tox);
A1=V/k1+(sin(k1*tox)*(Vbi-Vgs))/(tox*k1^2);
A2=(V)/k1+(sin(k1*tox)*(Vbi+Vds-Vgs))/(tox*k1^2);
d1=d1+(2*(sin(k1*(tox)))*kn*(A1+A2*((-1)^(n+1)))/(tox*(kn^2+k1^2)));
end
Dsf=((d1+d2-d3))/d4;
phi=phi+2*((sin(kn*x))*X1*Dsf)/(kn*Esi*L);
d1=0;
end
phi1=phi+Vbi+(x/L)*Vds+(Q*(x*L-(power(x,2))))/(2*Esi);
integration=double(int(1/(int(exp((phi1)/t1),y,tox,tox+tsi)),x,0,L));
but this will take too much time to run in Matlab 2012 is there any other way to run this code in Matlab 2012 without using double int command ? but not via this
phi1_fcn = matlabFunction(phi1);
int_y = @(x) 1./integral(@(y) exp(phi1_fcn(x,y)./t1), tox,tox+tsi, 'Array',true);
integration = integral(int_y, 0,L)
using this will give the error in Matlab 2012 given above

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2017-12-28
Change 'Array' to 'ArrayValued'

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by