有一个方程如图
源码是
function AA
D0=3.55e-19;
options=optimset('tolx',1e-9);
[D,resnorm,residual,exitflag,output,lambda,jacobian] = lsqnonlin(@fei,D0,[],[],options)
function F=fei(D)
C0=0.687;
d=0.02;
Ceq=20;
t=60;
C=4.136;
m=1-(C0-C)/(C0-Ceq);
s=[];
k=0:1000;
s=sum(8./(pi*(2*k+1)).^2.*exp(-D*(pi*(2*k+1)).^2*t*60/(d^2)));
s
F=sum((m-s').^2);
而得到的结果怎么也不对 如下
得到的D值怎么都是跟赋的D0值是一样的额
s =
0.9998
s =
0.2158
s =
Inf
s =
0.2447
s =
Inf
s =
0.2161
Optimization terminated: norm of the current step is less
than OPTIONS.TolX.
D =
3.5500e-019
resnorm =
0.0010
residual =
0.0318
exitflag =
2
output =
firstorderopt: 7.1546e+005
iterations: 2
funcCount: 6
cgiterations: 1
algorithm: 'large-scale: trust-region reflective Newton'
message: [1x77 char]
lambda =
lower: 0
upper: 0
jacobian =
(1,1) 2.2480e+007
到底怎么弄得,小弟是菜鸟,希望有高手跟好心人帮我5555
![]() |