作业帮 > 综合 > 作业

用matlab计算logistic中参数···~

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/18 11:16:25
用matlab计算logistic中参数···~
t=[0,10,22,32,42,51,61,76,87]
y=[3,25,27,24,54,91,169,160,176]
logistic方程为:y=K/1+a*exp(-rt)
请问 怎么用matlab计算方程中的三个参数(K,a,r)呢?
我自己算的K=195.5511,r=0.2241.好像不对呢郁闷了
还有怎么拟合数据呀?看参数拟合的R平方?
如果能给出具体方法就更好了~
还有希望标出最后计算出的参数分别都是什么,我看别人的提问里面 有的给出了计算方法 但是我都不知道哪个是哪个呀.
t=[0,10,22,32,42,51,61,76,87]';
y=[3,25,27,24,54,91,169,160,176]';
st_ = [200 0.1 0.2];
ft_ = fittype('K./(1+a*exp(-r*t))','dependent',{'y'},'independent',{'t'},'coefficients',{'K','a','r'});
[cf_,good]= fit(t,y,ft_ ,'Startpoint',st_)
h_ = plot(cf_,'fit',0.95);
legend off; % turn off legend from plot method call
set(h_(1),'Color',[1 0 0],...
'LineStyle','-','LineWidth',2,...
'Marker','none','MarkerSize',6);
hold on,plot(t,y,'*')
cf_ =
General model:
cf_(t) = K./(1+a*exp(-r*t))
Coefficients (with 95% confidence bounds):
K = 178.5 (141.5,215.5)
a = 243.4 (-629.6,1116)
r = 0.1142 (0.03371,0.1946)
good =
sse:1.7508e+003
rsquare:0.9554 %(R平方)
dfe:6
adjrsquare:0.9405
rmse:17.0821
再问: 谢谢您的解答! 不好意思再问您下,K a r三个参数后面括号里的都是什么呀?? 还有您算的R平方是0.9554 是不是多组参数拟合后的最高的R平方呢? 也是最好最显著的一组拟合参数呢? good后面的。。除了R平方 那些都是什么啊?有什么用呢? 问题有点琐碎有点多 不好意思了~~
再答: ,K a r三个参数后面括号里是估计的参数的95%的置信区间 R平方是0.9554 是,称为方程的确定系数,0~1之间,越接近1,表明方程的变量对y的解释能力越强。 SSE 与 RMSE 是标准差 和均方差,意义也一样,反映拟合误差的好坏 官方说法: SSE (趋向0最好)-- The sum of squares due to error. This statistic measures the deviation of the responses from the fitted values of the responses. A value closer to 0 indicates a better fit. R-square(趋向1最好) -- The coefficient of multiple determination. This statistic measures how successful the fit is in explaining the variation of the data. A value closer to 1 indicates a better fit. Adjusted R-square(趋向1最好) -- The degree of freedom adjusted R-square. A value closer to 1 indicates a better fit. It is generally the best indicator of the fit quality when you add additional coefficients to your model. RMSE(趋向0最好) -- The root mean squared error. A value closer to 0 indicates a better fit.
再问: 哦谢谢 还有很抱歉我输入的数据弄反了 y值是应该递减的 那是不是直接r就取相反数就对了呢??? 其实有个小请求。。。加您的qq 如果您觉得不合适 我也完全理解,,,我:576125082