禮品網(wǎng)站模板sem推廣競價
一.問題及重述:下表是中國人口數(shù)據(jù),請根據(jù)這些數(shù)據(jù)建立適當(dāng)?shù)臄?shù)學(xué)模型對其進(jìn)行描述,并預(yù)測2002、2003、2004年的中國人口數(shù)。
給出模型,求解代碼及必要的圖形,誤差分析結(jié)果。
重述:
- 選取合適的模型預(yù)測2002,2003、2004年的中國人口數(shù);
建立數(shù)學(xué)模型、給出求解代碼及必要的圖形,誤差分析結(jié)果
二.問題的分析和假設(shè): 2-1對于問題一的分析 根據(jù)題目中的數(shù)據(jù)只是一個粗略預(yù)報人口總數(shù)的模型,沒有對人口的年齡、性別、地域結(jié)構(gòu)進(jìn)行預(yù)報,故采用Malthus模型或Logistic模型 2-2對問題二的分析 我們通過使用數(shù)學(xué)知識和matlab對以上數(shù)據(jù)進(jìn)行計算,進(jìn)而求解,從而得到模型以及圖像。 2-3對Logistic模型的假設(shè) (1)設(shè)r(x)為x(t)的線性單調(diào)減函數(shù),即r(x)=r-sx(s>0); (2)自然資源與環(huán)境條件所能容納的最大人口數(shù)為Xm,即當(dāng)x=時,增長率r()=0。 由(1)、(2)可得: |
建模: 使用Logistic模型? 上式是一個可分離變量性的微分方程,其解為: 以下對其進(jìn)行擬合、求解以及繪圖 |
求解的Matlab程序代碼: ? 編寫M文件如下: Malthus模型:? 首先對數(shù)據(jù)進(jìn)行擬合: >> year=1988:1:2001; >>population=[11.1026,11.2074,11.4333,11.5823,11.7171,11.8517,11.9850 12.1121,12.2389,12.3626,12.4761,12.5786,12.6743,12.7627]; >> cftool ??????????????????????????????圖一 ?擬合數(shù)據(jù)圖 Matlab自動生成的擬合代碼: function?[fitresult, gof] = createFit2(year, population) %CREATEFIT2(YEAR,POPULATION) % ?Create a fit. % % ?Data for 'untitled fit 1' fit: % ?????X Input : year % ?????Y Output: population % ?Output: % ?????fitresult : a fit object representing the fit. % ?????gof : structure with goodness-of fit info. % % ?另請參閱 FIT, CFIT, SFIT. % ?由 MATLAB 于 06-Apr-2022 01:20:13 自動生成 %% Fit: 'untitled fit 1'. [xData, yData] = prepareCurveData( year, population ); % Set up fittype and options. ft = fittype( 'xm/(1+(xm/11.1026-1)*exp(-r*(t-1988)))', 'independent', 't', 'dependent', 'y'?); opts = fitoptions( 'Method', 'NonlinearLeastSquares'?); opts.Display = 'Off'; opts.StartPoint = [0.2 500]; % Fit model to data. [fitresult, gof] = fit( xData, yData, ft, opts ); % Plot fit with data. figure( 'Name', 'untitled fit 1'?); h = plot( fitresult, xData, yData ); legend( h, 'population vs. year', 'untitled fit 1', 'Location', 'NorthEast'?); % Label axes xlabel year ylabel population grid on 將以上代碼保存當(dāng)前文件夾,并在新的文件夾中調(diào)用這個函數(shù)得到參數(shù)的擬合值和預(yù)測的效果。 計算結(jié)果與結(jié)論: ? 通過Matlab進(jìn)行計算,得到如下答案: >> year=1988:1:2001; >>population=[11.1026,11.2074,11.4333,11.5823,11.7171,11.8517,11.9850 12.1121,12.2389,12.3626,12.4761,12.5786,12.6743,12.7627]; cftool >>[fitresult, gof] = createFit1(year, population) >>t = 2002:2004; >>xm = 14.42; ?? >>r = ?0.06451; >>predictions = xm./(1+(xm./11.1026-1).*exp(-r.*(t-1988))); >>figure(2) >>plot(year,population,'o',t,predictions,'.') ? >>disp(predictions) ? fitresult = ?????General model: ?????fitresult(t) = xm/(1+(xm/11.1026-1)*exp(-r*(t-1988))) ?????Coefficients (with 95% confidence bounds): ???????r = ????0.06451 ?(0.05625, 0.07277) ???????xm = ??????14.42 ?(14.03, 14.82) | |||
gof = ???????????sse: 0.0038 ???????rsquare: 0.9990 ???????????dfe: 12 ????adjrsquare: 0.9989 ??????????rmse: 0.0179 ???12.8624 ??12.9498 ??13.0328 圖二 ?人口模型預(yù)測圖 結(jié)論:當(dāng)t=2002 時人口為12.8624億、t=2003時人口為12.9498億、t=2004時人口為13.0328億。 誤差分析:查詢中國人口統(tǒng)計圖表得出2002年為12.8億 、2003年為12.88億、2004年為12.96億,發(fā)現(xiàn)兩者幾乎完全一致,Logistic模型的缺點是模型中的參數(shù)r和人口總數(shù)上限xm很難準(zhǔn)確得到,尤其是xm的值還會隨著人口發(fā)展變化的情況而改變。
|