第二次数学建模作业..doc
文本预览下载声明
4. 根据表 1.14 的数据,完成下列数据拟合问题:
表 1.14 美国人口统计数据(百万人)
年份 1790 1800 1810 1820 1830 1840 1850 1860 人口 3.9 5.3 7.2 9.6 12.9 17.1 23.2 31.4 年份 1870 1880 1890 1900 1910 1920 1930 1940 人口 38.6 50.2 62.9 76.0 92.0 106.5 123.2 131.7 年份 1950 1960 1970 1980 1990 2000 人口 150.7 179.3 204.0 226.5 251.4 281.4
解答:(1):
(i)执行程序:
t=1790:10:2000;
x=[3.9,5.3,7.2,9.6,12.9,17.1,23.2,31.4,38.6,50.2,62.9,76.2,92.0,106.5,123.2,131.7,150.7,179.3,204.0,226.5,251.4,281.4];
f=@(r,t)3.9.*exp(r(1).*(t-1790));
r=nlinfit(t,x,f,0.036)
sse=sum((x-f(r,t)).^2)
plot(t,x,k+,1790:10:2000,f(r,1790:10:2000),k)
axis([1790,2000,0,300]),legend(测量值,理论值)
xlabel(美国人口/(百万)),ylabel(年份)
title(美国人口指数增长模型图II)
运行结果:
Untitled
r =
0.0212
sse =
1.7433e+004
即,拟合效果:r =0.0212;误差平方和为:1.7433e+004拟合效果图(i):
(ii)由表1.14我们知道,当t=1800时,有,所以我们可以猜测, =2.5.
对待定参数,t=1790:10:2000;
x=[3.9,5.3,7.2,9.6,12.9,17.1,23.2,31.4,38.6,50.2,62.9,76.2,92.0,106.5,123.2,131.7,150.7,179.3,204.0,226.5,251.4,281.4];
f=@(r,t)r(1).*exp(r(2).*(t-1790));
r0=[2.5,0.1];
r=nlinfit(t,x,f,r0)
sse=sum((x-f(r,t)).^2)
plot(t,x,k+,1790:1:2000,f(r,1790:1:2000),k)
axis([1790,2000,0,300]),legend(测量值,理论值,2)
xlabel(美国人口/(百万)),ylabel(年份)
title(美国人口指数增长模型图II)
命令窗口显示的计算的结果如下:
Untitled
r =
15.0005 0.0142
sse =
2.2657e+003
即我们知道,拟合结果为:r=r(2)= 0.0142, =r(1)= 15.0005;误差平方和为:2.2657e+003.
拟合效果图(ii):
(iii)由表1.14我们知道,当t=1900时,有,所以我们可以猜测, =19, =1800.
对待定参数,,t=1790:10:2000;
x=[3.9,5.3,7.2,9.6,12.9,17.1,23.2,31.4,38.6,50.2,62.9,76.2,92.0,106.5,123.2,131.7,150.7,179.3,204.0,226.5,251.4,281.4];
f=@(r,t)r(1).*exp(r(2).*(t-r(3)));
r0=[19,0.03,1800];
r=nlinfit(t,x,f,r0)
sse=sum((x-f(r,t)).^2)
plot(t,x,k+,1790:1:2000,f(r,1790:1:2000),k)
axis([1790,2000,0,300]),legend(测量值,理论值,2)
xlabel(美国人口/(百万)),ylabel(年份)
title(美国人口指数增长模型图III)
命令窗口显示的计算的结果如下:
Untitled
Warning: The Jacobian at the solution is ill-conditioned, and some model parameters may not be estimated well (they are not identifiable). Use caution in making predictions.
In nlinfit at 224
In Untitled at
显示全部