谁会用origin拟合logistic曲线 50
结合网络上各种实现手法和使用SPSS进行拟合Logistic曲线的一些论文资料,现在我拿出来分享诸位读者,给大家这方面一点启迪。本来是要Gompertz、Logistic、Rayleigh曲线都要拟合的,我在这里仅作Logistic曲线拟合,其它两个方法类似,不多赘述。
Logistic曲线模型:
如下为拟合的原始数据点:
x 1 2 3 4 5 6 7 8
y
3 13 80 195 332 895 1038 1143
选定初始值A=500(至于为何选取A=500,请参阅相关文献资料,有相当多的方法供选取),分别代入x=1,F(x)=3和x=2,F(x)=13到 Logistic曲线方程
>>[b,c]=solve('500/(1+b*exp(-c*1))=3','500/(1+b*exp(-c*2))=13','b,c') 解得初始值:A=500, b=732.6,c=1.487 编写Matlab程序LogisticDemo.m如下:%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%x=1:8;y=[3,13,80,195,332,895,1038,1143];c0=[500,732.6,1.487];fun=inline('c(1)./(1+c(2).*exp(-c(3).*x))','c','x');b=nlinfit(x,y,fun,c0);bt=0:.01:8;plot(x,y,'r.',t,fun(b,t))%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Matlab中运行如上程序,结果如下图
红色框内对应的3个值即为A,b,c的参数解
最终解得: A=1165, b=3109,c=1.5 Logistic曲线方程为: