怎样在matlab里实现logistic拟合?求方程的三个参数
x=[1979198019811982198319841985198619871988198919901991199219931994199519961997199819...
x=[1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010]'; y=[0.15 1.20 3.30 9.50 19.00 30.61 40.29 42.11 49.84 60.00 76.78 99.13 153.54 187.80 248.28 318.74 349.99 379.51 418.29 465.73 512.71 576.32 592.53 607.17 627.34 635.67 645.82 674.27 699.99 726.21 753.56 786.17]'; 方程:y = a./(1+b.*exp(-k.*t));
展开
展开全部
x=[1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010]';
y=[0.15 1.20 3.30 9.50 19.00 30.61 40.29 42.11 49.84 60.00 76.78 99.13 153.54 187.80 248.28 318.74 349.99 379.51 418.29 465.73 512.71 576.32 592.53 607.17 627.34 635.67 645.82 674.27 699.99 726.21 753.56 786.17]';
st_ = [700 20 0.2];
ft_ = fittype('a/(1+b*exp(-k*(x-1979)))' ,...
'dependent',{'y'},'independent',{'x'},...
'coefficients',{'a', 'b', 'k'});
[cf_,good]= fit(x,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(x,y,'*')
cf_ =
General model:
cf_(x) = a/(1+b*exp(-k*(x-1979)))
Coefficients (with 95% confidence bounds):
a = 746.2 (720, 772.4)
b = 91.43 (57.71, 125.2)
k = 0.266 (0.2409, 0.2912)
good =
sse: 1.3360e+004
rsquare: 0.9946
dfe: 29
adjrsquare: 0.9942
rmse: 21.4640
y=[0.15 1.20 3.30 9.50 19.00 30.61 40.29 42.11 49.84 60.00 76.78 99.13 153.54 187.80 248.28 318.74 349.99 379.51 418.29 465.73 512.71 576.32 592.53 607.17 627.34 635.67 645.82 674.27 699.99 726.21 753.56 786.17]';
st_ = [700 20 0.2];
ft_ = fittype('a/(1+b*exp(-k*(x-1979)))' ,...
'dependent',{'y'},'independent',{'x'},...
'coefficients',{'a', 'b', 'k'});
[cf_,good]= fit(x,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(x,y,'*')
cf_ =
General model:
cf_(x) = a/(1+b*exp(-k*(x-1979)))
Coefficients (with 95% confidence bounds):
a = 746.2 (720, 772.4)
b = 91.43 (57.71, 125.2)
k = 0.266 (0.2409, 0.2912)
good =
sse: 1.3360e+004
rsquare: 0.9946
dfe: 29
adjrsquare: 0.9942
rmse: 21.4640
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询