fsolve 已停止,因为当前步长的相对大小小于 步长容差的平方的值,但按照函数容差的值衡量, 函数值向量不接近于零。

clc;clear;
syms x1 x2;
G=1e18;
k=1.38064852e-23;
h=6.62606896e-34;
pi=3.141592654;
e=1.6021892e-19;
m0=9.11e-31;
T=1000+273.15;
E0=3.507; a=9.09e-4; b=830;
Eg=E0-a*T^2/(b+T);
mc=0.2;
mv=1.5;
Ns=4.4e28;
vn=sqrt(3*k*T/mc/m0);
vp=sqrt(3*k*T/mv/m0);
cn1=1e-15*vn;cp1=1e-18*vp;
cn3=5e-19;cp3=5e-23;
cn2=1e-18*vn;cp2=1e-15*vp;
BB=1e-15;
CAugn=1e-31;CAugp=1e-31;
Nv = 2 *(2 * pi * mv * m0 * k * T)^1.5/(h^3);
Nc = 2 * (2 * pi * mc * m0 * k * T)^1.5/(h^3);
ni2=Nc.*Nv.*exp(-Eg.*e./k./T);
dE=x1-x2;
w=1/(1+exp(-dE*e/k/T));
n=Nc.*(w*exp((x1-Eg).*e./k./T)+(1-w)*exp((x2-Eg).*e./k./T));
p=Nv.*(w*exp(-x2.*e./k./T)+(1-w)*exp(-x1.*e./k./T));
EfD=w.*x1+(1-w).*x2;
EfA=w.*x2+(1-w).*x1;
MgEt=0.26;
Mg0=1*Ns*exp(-1.875*e/k/T);
Mg1=1*Ns.*exp(-(2.132-EfA).*e./k./T);
VNEt31=0.48;VNEt10=3.31;
VN0=1*Ns*exp(-3.486*e/k/T);
VN1=1*Ns.*exp(-(0.178+EfD).*e./k./T);
VN3=1*Ns.*exp(-(-0.781+3*EfD).*e./k./T);
UBB=BB*(n.*p-ni2);
UAug=(CAugn*n+CAugp*p).*(n.*p-ni2);
USMg1=Mg1.*(n.*p-ni2)./((1/(cp2.*vp)).*(n+Nc.*exp((MgEt-Eg).*e./k./T))+(1/(cn2.*vn)).*(p+Nv.*exp(-MgEt.*e./k./T)));
USVN1=VN1.*(n.*p-ni2)./((1/(cp1.*vp)).*(n+Nc.*exp((VNEt10-Eg).*e./k./T))+(1/(cn1.*vn)).*(p+Nv.*exp(-VNEt10.*e./k./T)));
USVN3=VN3.*(n.*p-ni2)./((1/(cp3.*vp)).*(n+Nc.*exp((VNEt31-Eg).*e./k./T))+(1/(cn3.*vn)).*(p+Nv.*exp(-VNEt31.*e./k./T)));
f1(x1,x2)=p+3*VN3+VN1-Mg1-n;
f2(x1,x2)=G-UBB-UAug-USMg1-USVN1-USVN3;
f=[f1 f2];
func = matlabFunction(f, 'Vars',{[x1, x2]});
[x,fval]= fsolve(func,[0.75,1.4])
No solution found. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance squared, but the vector of function values is not near zero as measured by the value of the function tolerance.
x = 1×2
0.9795 0.9795
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
fval = 1×2
1.0e+17 * 0.0000 -1.3082
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
对于这段代码最后的输出是找不到解,fsolve 已停止,因为当前步长的相对大小小于 步长容差的平方的值,但按照函数容差的值衡量, 函数值向量不接近于零。要如何优化得到数值解

답변 (0개)

카테고리

도움말 센터File Exchange에서 函数基础知识에 대해 자세히 알아보기

태그

질문:

2025년 10월 15일

편집:

2025년 10월 24일

Community Treasure Hunt

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

Start Hunting!