常微分方程的數(shù)值解法(歐拉法、改進(jìn)歐拉法、泰勒方法和龍格庫(kù)塔法)_第1頁(yè)
常微分方程的數(shù)值解法(歐拉法、改進(jìn)歐拉法、泰勒方法和龍格庫(kù)塔法)_第2頁(yè)
常微分方程的數(shù)值解法(歐拉法、改進(jìn)歐拉法、泰勒方法和龍格庫(kù)塔法)_第3頁(yè)
常微分方程的數(shù)值解法(歐拉法、改進(jìn)歐拉法、泰勒方法和龍格庫(kù)塔法)_第4頁(yè)
常微分方程的數(shù)值解法(歐拉法、改進(jìn)歐拉法、泰勒方法和龍格庫(kù)塔法)_第5頁(yè)
已閱讀5頁(yè),還剩6頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、例1用歐拉方法與改進(jìn)的歐拉方法求初值問(wèn)題在區(qū)間0,1上取的數(shù)值解。解歐拉方法的計(jì)算公式為使用excel表格進(jìn)行運(yùn)算,相應(yīng)結(jié)果如下例一:歐拉法nxy精確解001110.111.00332220.21.0066671.01315930.31.0198241.02914240.41.0390541.05071850.51.0637541.07721760.61.0932111.10793270.71.1266811.14216580.81.1634431.17927490.91.2028451.2186891011.2443141.259921現(xiàn)用matlab編程,程序如下x0=0;y0=1;x(1

2、)=0.1;y(1)=y0+0.1*2*x0/(3*y02);for n=1:9 x(n+1)=0.1*(n+1); y(n+1)=y(n)+0.1*2*x(n)/(3*y(n)2); end; x y 結(jié)果為x = Columns 1 through 8 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 Columns 9 through 10 0.9000 1.0000y = Columns 1 through 8 1.0000 1.0067 1.0198 1.0391 1.0638 1.0932 1.1267 1.1634 C

3、olumns 9 through 10 1.2028 1.2443改進(jìn)的歐拉方法其計(jì)算公式為本題的精確解為,可用來(lái)檢驗(yàn)數(shù)值解的精確度,列出計(jì)算結(jié)果。使用excel表格進(jìn)行運(yùn)算,相應(yīng)如下例一:改進(jìn)的歐拉法nx預(yù)測(cè)y校正y精確解0011110.111.0033331.00332220.21.0099561.013181.01315930.31.0261691.0291711.02914240.41.0480541.0507511.05071850.51.0749041.0772521.07721760.61.1059761.1079651.10793270.71.1405491.1421941.1

4、4216580.81.1779651.1792971.17927490.91.2176461.2187061.2186891011.2591031.259931.259921現(xiàn)用matlab編程,程序如下x0=0;y0=1;x(1)=0.1;ya(1)=y0+0.1*2*x0/(3*y02);y(1)=y0+0.05*(2*x0/(3*y02)+2*x0/(3*ya2);for n=1:9 x(n+1)=0.1*(n+1); ya(n+1)=ya(n)+0.1*2*x(n)/(3*ya(n)2); y(n+1)=y(n)+0.05*(2*x(n)/(3*y(n)2)+2*x(n+1)/(3*y

5、a(n+1)2); end; x y 結(jié)果為x = Columns 1 through 8 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 Columns 9 through 10 0.9000 1.0000y = Columns 1 through 8 1.0000 1.0099 1.0261 1.0479 1.0748 1.1059 1.1407 1.1783 Columns 9 through 101.2183 1.2600例2用泰勒方法解分別用二階、四階泰勒方法計(jì)算點(diǎn)0.1, 0.2, , 1.0處的數(shù)值解,并與精確解進(jìn)行

6、比較。解:二階泰勒方法對(duì)于本題故使用excel表格進(jìn)行運(yùn)算,相應(yīng)結(jié)果如下nxy精確解001110.11.0033331.00332220.21.0132231.01315930.31.0292911.02914240.41.0509691.05071850.51.0775751.07721760.61.1083881.10793270.71.1427041.14216580.81.1798781.17927490.91.219341.2186891011.2606011.259921現(xiàn)用matlab編程,程序如下x0=0;y0=1;x(1)=0.1;y(1)=y0+0.1/(3*y02)*(2

7、*x0+0.1*(1-4*x02/(3*y03);for n=1:9 x(n+1)=0.1*(n+1); y(n+1)=y(n)+0.1/(3*y(n)2)*(2*x(n)+0.1*(1-4*x(n)2/(3*y(n)3); end; x y結(jié)果為x = Columns 1 through 9 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 Column 10 1.0000y = Columns 1 through 9 1.0033 1.0132 1.0293 1.0510 1.0776 1.1084 1.1427

8、1.1799 1.2193 Column 10 1.2606四階泰勒方法使用excel表格進(jìn)行運(yùn)算,相應(yīng)結(jié)果如下例二:四階泰勒方法nxyy的一階導(dǎo)數(shù)y的二階導(dǎo)數(shù)y的三階導(dǎo)數(shù)y的四階導(dǎo)數(shù)精確解00100.666667 0-1.33333110.11.0033280.0662250.653509-0.13402-1.183061.00332220.21.0131910.1298840.616121-0.2711 -0.790411.01315930.31.0292110.1888080.560087-0.40991-0.29471.02914240.41.0508230.2414960.49274

9、-0.543790.1597871.05071850.51.0773460.2871890.421266-0.663420.4828091.07721760.61.1080630.3257850.351405-0.760550.6515451.10793270.71.1422740.3576560.286967-0.830570.6901671.14216580.81.1793390.3834610.229962-0.872960.6414121.17927490.91.2186920.4039830.181038-0.89030.546371.2186891011.259850.420021

10、0.13996-0.886940.4355851.259921現(xiàn)用matlab編程,程序如下x0=0;y0=1;ya0=2*x0/(3*y02);%一階導(dǎo)數(shù)yb0=2/(3*y02)-8*x02/(9*y05);%二階導(dǎo)數(shù)yc0=-4*x0/(3*y05)-80*x03/(27*y08);%三階導(dǎo)數(shù)yd0=-4/(3*y05)+40*x02/(3*y08)-1280*x04/(81*y011);%四階導(dǎo)數(shù)x(1)=0.1;y(1)=y0+0.1*ya0+0.01/2*yb0+0.001/6*yc0+0.0001/24*yd0;ya(1)=2*x(1)/(3*y(1)2);%一階導(dǎo)數(shù)yb(1)=

11、2/(3*y(1)2)-8*x(1)2/(9*y(1)5);%二階導(dǎo)數(shù)yc(1)=-4*x(1)/(3*y(1)5)-80*x(1)3/(27*y(1)8);%三階導(dǎo)數(shù)yd(1)=-4/(3*y(1)5)+40*x(1)2/(3*y(1)8)-1280*x(1)4/(81*y(1)11);%四階導(dǎo)數(shù)for n=1:9 x(n+1)=0.1*(n+1); y(n+1)=y(n)+0.1*ya(n)+0.01/2*yb(n)+0.001/6*yc(n)+0.0001/24*yd(n); ya(n+1)=2*x(n+1)/(3*y(n+1)2);%一階導(dǎo)數(shù) yb(n+1)=2/(3*y(n+1)2)

12、-8*x(n+1)2/(9*y(n+1)5);%二階導(dǎo)數(shù) yc(n+1)=-4*x(n+1)/(3*y(n+1)5)-80*x(n+1)3/(27*y(n+1)8);%三階導(dǎo)數(shù) yd(n+1)=-4/(3*y(n+1)5)+40*x(n+1)2/(3*y(n+1)8)-1280*x(n+1)4/(81*y(n+1)11);%四階導(dǎo)數(shù) end; xY結(jié)果為x = Columns 1 through 8 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 Columns 9 through 10 0.9000 1.0000y = Colu

13、mns 1 through 8 1.0033 1.0132 1.0292 1.0508 1.0773 1.1081 1.1423 1.1793 Columns 9 through 101.2187 1.2598例3用標(biāo)準(zhǔn)四階RK方法求在區(qū)間0, 1上,的數(shù)值解以及在區(qū)間1, 10上,的數(shù)值解,并與精確解進(jìn)行比較。解:對(duì)于本題使用excel表格進(jìn)行運(yùn)算,相應(yīng)結(jié)果如下例三:標(biāo)準(zhǔn)四階RK方法nxyk1k2k3k4精確解00100.0033330.0033220.006623110.11.0033220.0066230.0098690.0098370.0129891.00332220.21.01315

14、90.0129890.016030.0159830.0188831.01315930.31.0291430.0188830.0216320.0215750.0241541.02914240.41.0507180.0241540.026560.02650.0287261.05071850.51.0772170.0287260.0307720.0307150.0325861.07721760.61.1079320.0325860.0342860.0342340.0357721.10793270.71.1421650.0357720.0371550.0371110.038351.14216580.8

15、1.1792740.038350.0394540.0394170.0403981.17927490.91.2186890.0403990.0412640.0412350.0419971.2186891011.2599210.0419970.0426630.0426410.0432221.259921現(xiàn)用matlab編程,程序如下x0=0;y0=1;k10=2*0.1*x0/(3*y02);k20=2*0.1*(x0+0.05)/(3*(y0+k10/2)2);k30=2*0.1*(x0+0.05)/(3*(y0+k20/2)2);k40=2*0.1*(x0+0.1)/(3*(y0+k30)2)

16、;x(1)=0.1;y(1)=y0+(k10+2*k20+2*k30+k40)/6;k1(1)=2*0.1*x(1)/(3*y(1)2);k2(1)=2*0.1*(x(1)+0.05)/(3*(y(1)+k1(1)/2)2);k3(1)=2*0.1*(x(1)+0.05)/(3*(y(1)+k2(1)/2)2);k4(1)=2*0.1*(x(1)+0.1)/(3*(y(1)+k3(1)2);for n=1:9 x(n+1)=0.1*(n+1); y(n+1)=y(n)+(k1(n)+2*k2(n)+2*k3(n)+k4(n)/6; k1(n+1)=2*0.1*x(n+1)/(3*y(n+1)2); k2(n+1)=2*0.1*(x(n+1)+0.05)/(3*(y(n+1)+k1(n+1)/2)2); k3(n+1)=2*0.1*(x(n+1)+0.05)/(3*(y(n+1)+k2(n+1)/2)2); k4(n+1)=2*0.1*(x(n+1)+0.1)/(3*(y(n+1)+k3(n+1)2); end; x y結(jié)果為x = Columns 1 through 8 0.1000 0.2000 0.3000 0

溫馨提示

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

評(píng)論

0/150

提交評(píng)論