人口增长模型的确定
1790-1980年间美国每隔10年的人口记录如下表所示。
1.试用以上数据建立马尔萨斯(Malthus)人口指数增长模型,并对接下来的每隔十年预测五次人口数量,并查阅实际数据进行比对分析。
2.如果数据不相符,再对以上模型进行改进,寻找更为合适的模型进行预测,并对两次预测结果进行对比分析。
3.查阅资料找出中国人口与表1同时期的人口数量,用以上建立的两个模型进行人口预测与分析。
http://www.doc88.com/p-773826839689.html
http://www.docin.com/p-938750966.html
https://wenku.baidu.com/view/df497b3410661ed9ad51f36f.html
http://www.doc88.com/p-414778587173.html
##马尔萨斯
clear;
clc;
%% ---------------------------------------------------
% 马尔萨斯1:求模型
% ------------------------------------------------------------
t = (0:19); % 1790-1980 共20年
x = [3.9, 5.3, 7.2, 9.6, 12.9, 17.1, 23.2, 31.4, 38.6, 50.2, 62.9, 76.0, 92.0, 106.5, 123.2, 131.7, 150.7, 179.3, 204.0, 226.5];
subplot(1, 2, 1);
plot(t, x, ' o');
y = log(x);
p = polyfit(t, y, 1) % 求出p, y = p[1] * t + p[2]
% 得到,p[1] = 0.2142, p[2] = 1.7213
% 所以,x0 = e^p[2] = e^1.7213 = 5.5917
x0 = exp(p(2))
% 所以,x(t) = 5.5917 * e^0.2142t
%% ---------------------------------------------------
% 马尔萨斯2:预测
% ------------------------------------------------------------
tPredict = (20:24);
xPredict = 5.5917 * exp(0.2142 * tPredict);
subplot(1, 2, 2);
plot([t,tPredict], [x , xPredict], ' *');
% xPredict = [405, 502, 622, 771, 955]
##logistic 阻滞增长
已知公式+数据,求参数(即拟合问题)
clear
clc
% 准备数据
t = (0:19); % 1790-1980 共20年
x = [3.9, 5.3, 7.2, 9.6, 12.9, 17.1, 23.2, 31.4, 38.6, 50.2, 62.9, 76.0, 92.0, 106.5, 123.2, 131.7, 150.7, 179.3, 204.0, 226.5];
plot(t, x, ' o');
hold on;
% 已知x(0) = 3.9
myfunc = @(a, t)[a(1) / ((1 + a(1) / 3.9) - 1) * exp(-a(2) * (t - 0))];
a0 = [500, 1];
a = lsqcurvefit(myfunc, a0, t, x);
disp(['a= ' num2str(a)]);
a
tPredict = (20:24);
xPredict = myfunc(a, tPredict);
plot([t, tPredict], [x, xPredict], ' *r');
真实数据1
真实数据2
对比以后发现并不理想,下午继续看。