作业帮 > 综合 > 作业

MATLAB求解logistic阻滞模型的三个参数

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/17 04:25:34
MATLAB求解logistic阻滞模型的三个参数
求教大神帮看,我用的MATLAB版本R2012a
希望求出函数中三个参数,但是老是运行不出来
>> xdata=[1,2,3,4,5,6,7,8,9,10,11,12,13,14];
>> ydata=[124761 125786 126743 127627 128453 129227 129988 130756 131448 132129 132802 133474 134091 134735];
>> f=inline('p(1)./(1+(p(1)/p(2)-1)*exp(-p(3)*xdata))','p','xdata');
>> p=lsqcurvefit(f,[167570,123740,0.005],xdata,ydata);
Local minimum possible.
lsqcurvefit 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.

f=inline('p(1)./(1+(p(1)/p(2)-1)*exp(-p(3)*xdata))','p','xdata');
改成这样
f=inline('p(1)./(1+(p(1)./p(2)-1).*exp(-p(3).*xdata))','p','xdata');
就ok了.
>> xdata=[1,2,3,4,5,6,7,8,9,10,11,12,13,14];
>> ydata=[124761 125786 126743 127627 128453 129227 129988 130756 131448 132129 132802 133474 134091 134735];
>> f=inline('p(1)./(1+(p(1)./p(2)-1).*exp(-p(3).*xdata))','p','xdata');
>> p=lsqcurvefit(f,[167570,123740,0.005],xdata,ydata);
>> vpa(p)
ans =
[ 146892.17624742476618848741054535,123858.20345970198104623705148697,0.051286170709734291150994067720603]