% 定义年份和人口数量 year = [1954:1:2019]; pop = [60.2,61.5,62.8,64.6,66.0,65.49,66.7,66.03,66.58,68.23,69.84,71.52,73.54,75.46,77.45,79.60,81.83,84.11,86.20,88.19,90.04,91.64,93.07,94.35,95.61,96.90,98.12,99.39,100.86,102.33,103.68,105.10,106.68,108.40,110.16,111.87,113.52,115.08,116.49,117.84,119.18,120.49,121.76,123.01,124.19,125.27,126.26,127.19,128.04,128.84,129.61,130.37,131.10,130.79,132.47,133.13,133.77,134.41,135.07,135.74,136.43,137.12,137.87,138.64,139.27,139.77];

% 定义阻滞增长模型公式 f = @(p,x)(p(1)x.(1-p(2)*x/p(1)));

% 初始参数值 p0 = [150, 0.1];

% 进行拟合 [p,resnorm,~,exitflag,output] = lsqcurvefit(f,p0,year(1:end-1),pop(1:end-1));

% 输出拟合结果 r = p(1); x_m = p(2); disp(['r=',num2str(r)]); disp(['x_m=',num2str(x_m)]);

% 绘制原始数据和拟合函数图像 figure; plot(year, pop, 'bo', 'MarkerSize', 5); hold on; plot(year, f(p, year), 'r-', 'LineWidth', 1); xlabel('年份'); ylabel('人口数量(千万)'); legend('原始数据', '拟合函数'); title(['拟合结果 r=',num2str(r),', x_m=',num2str(x_m)]);

% 检验拟合结果 year_test = 2019; pop_test = f(p, year_test); disp(['2019年预测人口数量为',num2str(pop_test),'(实际值为139.77)'])

利用matlab和阻滞增长模型分析我国的人口变化规律。人口数量如下表单位:千万 年份	1954	1955	1956	1957	1958	1959	1960	1961	1962人口	602	615	628	646	660	6549	667	6603	6658年份	1963	1964	1965	1966	1967	1968	1969	1970	1971人口	6823	6984	7152	7354	75

原文地址: https://www.cveoy.top/t/topic/c849 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录