有一个方程如图
源码是
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.
lsqnonlin stopped because the final change in the sum of squares relative to
its initial value is less than the default value of the function tolerance.