作业帮 > 综合 > 作业

急 s型曲线函数表达式用matlab怎么拟合

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/03 07:40:46
急 s型曲线函数表达式用matlab怎么拟合
x=[1978:1:2010];
y=[566 632 745 755 769 789 985 1110 1313 1428 1782 1920 2150 2292 2601 3149 4338 5145 5809 6241 6854 7656 8772 10007 11374 12567 14332 16614 19228 22844 26404 29688 32074]; 用函数y=800000/(1+1324.1*e^(-r(x-1978))) 拟合 求程序 要求求出r的
x=[1978:1:2010]';
y=[566 632 745 755 769 789 985 1110 1313 1428 1782 1920 2150 2292 2601 3149 4338 5145 5809 6241 6854 7656 8772 10007 11374 12567 14332 16614 19228 22844 26404 29688 32074]';
st_ = [0.5];
ft_ = fittype('800000/(1+1324.1*exp(-r*(x-1978))) ' ,...
'dependent',{'y'},'independent',{'x'},...
'coefficients',{'r'});
[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) = 800000/(1+1324.1*exp(-r*(x-1978)))
Coefficients (with 95% confidence bounds):
r = 0.1254 (0.1247,0.126)
good =
sse:1.2235e+007
rsquare:0.9953
dfe:32
adjrsquare:0.9953
rmse:618.3457