funtion f=myfun(a,x)
f=1./(a(3)+a(1)*exp(a(2)*x));
x = [3.9900 9.9900 16.3900 22.7900 29.1900 35.1900 41.5900...
47.9900 53.9900 60.3900 66.7900 72.7900 79.1900 85.5900...
91.9900 97.9900];
y=[2.1634 2.9223 4.0168 5.4091 7.0874 9.2672 11.6971...
13.8987 15.9450 17.5862 18.4444 18.9926 19.5583 19.7022...
19.5028 19.8513];
a0=[1 -.1 1];
options=optimset('MaxFunEvals',1000000);
options=optimset('MaxIter',1000000);
[a,residual]=lsqcurvefit(@myfun,a0,x,y,[],[],options)
plot(x,y,'o')
hold on
plot(x,1./(a(3)+a(1)*exp(a(2)*x)))
解得
a =
0.7546 -0.0740 0.0493
residual =
1.2527
其中a(1)为a,a(2)为b,a(3)为c |