離散數(shù)據(jù)擬合模型_第1頁
離散數(shù)據(jù)擬合模型_第2頁
離散數(shù)據(jù)擬合模型_第3頁
離散數(shù)據(jù)擬合模型_第4頁
離散數(shù)據(jù)擬合模型_第5頁
已閱讀5頁,還剩6頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

1、工程技術(shù)大學(xué)上機實驗報告成績實驗名稱實驗 2 離散數(shù)據(jù)擬合模型院系理學(xué)院專業(yè)班級11-1學(xué)號日期05.20實驗 目的簡述本次實驗?zāi)康模?掌握離散數(shù)據(jù)擬合模型的建模方法,并會利用 Matlab 作數(shù)據(jù)擬合、數(shù)值計算與 誤差分析 .實驗 準(zhǔn)備你為本次實驗做了哪些準(zhǔn)備: 上網(wǎng)查閱相關(guān)資料,閱讀教材數(shù)學(xué)建模實驗 進度本次共有 4 個練習(xí),完成 4 個。實驗 總結(jié) 日本次實驗的收獲、體會、經(jīng)驗、問題和教訓(xùn):實驗題目:已知美國人口統(tǒng)計數(shù)據(jù)如表,完成下列數(shù)據(jù)的擬合問題:年份 1790 1800 1810 1820 1830 1840 1850 1860人口 / 百萬人 3.9 5.3 7.2 9.6 12.

2、9 17.1 23.2 31.4年份 1900 1910 1920 1930 1940 1950 1960 1970人口 / 百萬人 76.0 92.0 106. 123.2 131.7 150. 179.3 204.5 7 0實驗要求:1、如果用指數(shù)增長模型 x(t) x0er(t t0) 模擬美國人口 1790 年至 2000 年的變 化過程,請用 Matlab 統(tǒng)計工具箱的函數(shù) nlinfit 計算指數(shù)增長模型的以下三個 數(shù)據(jù)擬合問題:(1)取定 x0=3.9, t 0=1790,擬合待定參數(shù) r; 程序代碼: p=(r,t)3.9.*exp(r.*(t-1790); t=1790:10

3、:2000; c=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,251.4,281.4; r=nlinfit(t,c,p,0.0359); sse=sum(c-p(r,t).2); | plot(t,c,b*,1790:1:2000,p(r,1790:1:2000),b) axis(1790,2000,0,290) xlabel( 年份 ),ylabel( 人口(單位:百萬) ) title( 擬合美國人口數(shù)據(jù) -指數(shù)增長型 ) leg

4、end( 擬合數(shù)據(jù) ) 程序調(diào)用: r r = 0.0212 sse sse = 1.7418e+004(2)取定 t 0=1790,擬合待定參數(shù) x0和 r ; 程序代碼: p=(r,t)r(2).*exp(r(1).*(t-1790); t=1790:10:2000; c=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,251.4,2 81.4; r0=0.0359,3.9; r=nlinfit(t,c,p,r0); sse=sum(

5、c-p(r,t).2); plot(t,c,b*,1790:1:2000,p(r,1790:1:2000),b) axis(1790,2000,0,290) xlabel( 年份 ),ylabel( 人口(單位:百萬) ) title( 擬合美國人口數(shù)據(jù) - 指數(shù)增長型 ) legend( 擬合數(shù)據(jù) ) 程序調(diào)用: r r =0.0142 14.9940 sse sse = 2.2639e+003(3)擬合待定參數(shù) t 0, x0和 r .要求寫出程序,給出擬合參數(shù)和誤差平方和 的計算結(jié)果,并展示誤差平方和最小的擬合效果圖 .程序代碼: p=(r,t)r(2).*exp(r(1).*(t-17

6、90+1.*r(3); t=1790:10:2000; c=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,251.4,281.4; r0=0.0359,3.9,1; r,x=nlinfit(t,c,p,r0); sse=sum(c-p(r,t).2); a=1790+1.*r(3); subplot(2,1,1) plot(t,c,b*,1790:1:2000,p(r,1790:1:2000),b) axis(1790,2000,0,2

7、90) xlabel( 年份 ),ylabel( 人口(單位:百萬) ) title( 擬合美國人口數(shù)據(jù) - 指數(shù)增長型 ) legend( 擬合數(shù)據(jù) ) subplot(2,1,2) plot(t,x,k+,1790:2000,0,0,k) axis(1790,2000,-20,20) xlabel( 年份 ),ylabel( 人口(單位:百萬) ) title( 擬合誤差 )程序調(diào)用: r r = 0.0142 7.3264 50.3522 x x =Columns1through5-11.0940-11.9857-12.7277-13.373513.5848Columns6through

8、10-13.4328-11.9995-9.1795-8.18183.7321Columns11through150.72484.32189.366411.236413.3761Columns 16 through 20 5.0903 4.7390 11.0299 10.0111 2.8613Columns 21 through 22 -6.4202 -15.8260 sse sse = 2.2639e+003 a a = 1.8404e+0032、通過變量替換, 可以將屬于非線性模型的指數(shù)增長模型轉(zhuǎn)化成線性模型, 并用 Matlab 函數(shù) polyfit 進行計算,請說明轉(zhuǎn)化成線性模型的詳細(xì)過

9、程,然后 寫出程序,給出擬合參數(shù)和誤差平方和的計算結(jié)果,并展示擬合效果圖 . 非線性模型的指數(shù)增長模型轉(zhuǎn)化成線性模型 程序代碼 : t=1790:10:2000;c=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,251.4,281.4; p,s=polyfit(t-1790,log(c),1)b1=p(1) b2=exp(p(2) subplot(2,1,1) plot(t,c,r*,t,exp(polyval(p,t-1790),r

10、)axis(1790,2000,0,290)xlabel( 年份),ylabel( 人口(單位 :百萬) )title( 擬合美國人口數(shù)據(jù)指數(shù)增長型 ) legend( 擬合數(shù)據(jù) )c1=(c-exp(polyval(p,t-1790).2c2=sum(c1) subplot(2,1,2) plot(t,c1,k+,1790,2000,0,0,k) axis(1790,2000,-20,20) xlabel( 年份 ),ylabel(誤差 )title( 擬合誤差 ) 程序調(diào)用 :p = 0.0202 1.7992s =R: 2x2 doubledf: 20normr: 1.1418 b1 =

11、 0.0202b2 = 6.0450c1 = 1.0e+004 *Columns 1 through 40.00050.00040.00030.0002Columns 5 through 8Columns 9 through 12Columns 13 through 160.00000.00660.00000.00080.00420.01660.02970.04040.05560.05180.04280.0039Columns 17 through 200.00080.00760.06840.3049Columns 21 through 220.87321.9802c2 = 3.4892e+0

12、043、請分析指數(shù)增長模型非線性擬合和線性化擬合的結(jié)果有何區(qū)別?原因是什么?非線性擬合線性擬合Nx04、如果用阻滯增長模型 x(t)x0 (N x0)e r(tt ) 模擬美國人口 1790年至 t0)2000 年的變化過程,請用 Matlab 下三個數(shù)據(jù)擬合問題:(1)取定 x0=3.9, t 0=1790, 程序代碼 : p=(a,t)(a(2).*3.9)./(3.9+(a(2)-3.9).*exp(-a(1).*(t-1790);統(tǒng)計工具箱的函數(shù)擬合待定參數(shù) r 和nlinfit 計算阻滯增長的以N; t=1790:10:2000; c=3.9,5.3,7.2,9.6,12.9,17.

13、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,251.4,281.4; a=nlinfit(t,c,p,0.03,350) sse=sum(c-p(a,t).2) plot(t,c,r*,t,p(a,t),r) axis(1790,2000,0,300) xlabel( 年份),ylabel( 人口(單位 :百萬) ) title( 擬合美國人口數(shù)據(jù)阻滯增長型 ) legend( 擬合數(shù)據(jù) ) 程序調(diào)用: a = 0.0274 342.4418 sse = 1.2249e+003(2

14、)取定 t 0=1790, 擬合待定參數(shù) x0, r 和 N; 程序代碼: p=(a,t)(a(2).*a(3)./(a(3)+(a(2)-a(3).*exp(-a(1).*(t-1790); t=1790:10:2000; c=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,251.4,281.4; a=nlinfit(t,c,p,0.03,350,4.0) sse=sum(c-p(a,t).2) plot(t,c,r*,t,p(a,

15、t),r) axis(1790,2000,0,300) xlabel( 年份 ),ylabel( 人口(單位 : 百萬) ) title( 擬合美國人口數(shù)據(jù)阻滯增長型 ) legend( 擬合數(shù)據(jù) ) 程序調(diào)用:a = 0.0215 446.5732 7.6981sse = 457.74053)擬合待定參數(shù)t 0, x0, r 和 N. 要求寫出程序,給出擬合參數(shù)和誤差平方 和的計算結(jié)果,并展示誤差平方和最小的擬合效果圖 p=(a,t)(a(2).*a(3)./(a(3)+(a(2)-a(3).*exp(-a(1).*(t-1790+1*a(4); t=1790:10:2000; c=3.9,

16、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,251.4,281.4; a,x=nlinfit(t,c,p,0.03,350,4.0,10) sse=sum(c-p(a,t).2) t0=1790+1*a(4) subplot(2,1,1) plot(t,c,r*,t,p(a,t),r) axis(1790,2000,0,300) xlabel( 年份),ylabel( 人口(單位 :百萬) ) title( 擬合美國人口數(shù)據(jù)阻滯增長型 ) legend( 擬合數(shù)據(jù) ) subplot(2,1,2) plot(t,x,k*,1790,2000,0,0,k-) axis(1790,2000,-20,20) xlabel( 年份 ),ylabel(誤差 ) title( 擬合誤差圖阻滯增長型 ) legend( 擬合數(shù)據(jù) )程序調(diào)用:a = 0.0215 446.5731 5.0700 19.6593x = Columns 1 through 4 -3.7981 -4.2097 -4.5362 -4.8667教師 評語Colu

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論