版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
姓名:樊元君 學(xué)號(hào):2012200902 日期:2012.11.06一、實(shí)驗(yàn)?zāi)康恼莆誐ATLAB語(yǔ)言、C/C++語(yǔ)言編寫(xiě)計(jì)算程序的方法、掌握改進(jìn)歐拉法與四階龍格-庫(kù)塔求解一階常微分方程的初值問(wèn)題。掌握使用MATLAB程序求解常微分方程問(wèn)題的方法。、實(shí)驗(yàn)內(nèi)容1、分別寫(xiě)出改進(jìn)歐拉法與四階龍格-庫(kù)塔求解的算法,編寫(xiě)程序上機(jī)調(diào)試出結(jié)果,要求所編程序適用于任何一階常微分方程的數(shù)值解問(wèn)題,即能解決這一類(lèi)問(wèn)題,而不是某一個(gè)冋題。實(shí)驗(yàn)中以下列數(shù)據(jù)驗(yàn)證程序的正確性。&&-*~ /,步長(zhǎng)h=0.252、實(shí)驗(yàn)注意事項(xiàng)yr=一科亠応—二 -必-匯的精確解為- ,通過(guò)調(diào)整步長(zhǎng),觀察結(jié)果的精度的變化三、程序流程圖:?改進(jìn)歐拉格式流程圖:?四階龍格庫(kù)塔流程圖:開(kāi)始初!|點(diǎn)CxO,yO);(K.Y)xl=xO+h;kl=f(xO,yO);k2=f(x0+h/2ty0+h/2*kl);k3=f(xO+h/2.y0+h/2*k2);k4=f(xl,yO+h*k3);yl=yO+h/6*(k!+2*k2+2*k3+k4).i=i+l;xO=xl;yO=y1四、源程序:?改進(jìn)后歐拉格式程序源代碼:function[]=GJOL(h,x0,y0,X,Y)formatlongh=input('h=');x0=input('x0=');y0=input('y0=');disp('輸入的范圍是:');X=input('X=');Y=input('Y=');n=round((Y-X)/h);i=1;x1=0;yp=0;yc=0;fori=1:1:nx1=x0+h;yp=yO+h*(-xO*(yOF2);%yp=yO+h*(yO-2*xO/yO);%yc=y0+h*(-x1*(ypf2);%yc=y0+h*(yp-2*x1/yp);%y1=(yp+yc)/2;x0=x1;y0=y1;y=2/(1+x0A2);%y=sqrt(1+2*x0);%fprintf('結(jié)果=%.3f,%.8f,%.8f\n',x1,y1,y);endend?四階龍格庫(kù)塔程序源代碼:function[]=LGKT(h,x0,y0,X,Y)formatlongh=input('h=');x0=input('x0=');y0=input('y0=');disp('輸入的范圍是:');X=input('X=');Y=input('Y=');n=round((Y-X)/h);i=1;x1=0;k1=0;k2=0;k3=0;k4=0;fori=1:1:nx1=x0+h;k1=-xO*yOA2;%k1=yO-2*xO/yO;%k2=(-(x0+h/2)*(y0+h/2*k1)A2);%k2=(y0+h/2*k1)-2*(x0+h/2)/(y0+h/2*k1);%k3=(-(x0+h/2)*(y0+h/2*k2)A2);%k3=(y0+h/2*k2)-2*(x0+h/2)/(y0+h/2*k2);%k4=(-(x1)*(y0+h*k3f2);%k4=(y0+h*k3)-2*(x1)/(y0+h*k3);%y1=y0+h/6*(k1+2*k2+2*k3+k4);%y1=y0+h/6*(k1+2*k2+2*k3+k4);%x0=x1;y0=y1;y=2/(1+x0A2);%y=sqrt(1+2*x0);%fprintf('結(jié)果=%.3f,%.7f,%.7f\n',x1,y1,y);endend五、運(yùn)行結(jié)果:改進(jìn)歐拉格式結(jié)果:?GJOLh=0?25xO=Oy0=2輸入的范國(guó)是:X=0Y=5結(jié)果刊?250,k87600000,1.88235294結(jié)果二0.500,1.59389108,1.60000000結(jié)果二0.750,L2823900S,1-28000000結(jié)果叫.000,1,00962125,L00000000結(jié)果=1.250,0.79318809,0.73048780結(jié)果“?500,0.62915123,0.61538462結(jié)果=1.750,0-50372S54,0.4923076S結(jié)果二N000,0.40966655,0.40000000結(jié)果二2.250,0*33736499,0.3298&691結(jié)果二近500,0.2823574S,0.275S6207結(jié)果W?750,0.23885673,0.23357564結(jié)果=王000,0.20429990,0.20000000結(jié)果250,0.17648S88,0.17297297結(jié)果二500,0.15383629,0.15094340結(jié)果二3.「50,61351747S,0.13278008結(jié)果二4?000,0.11964242,0.11764706結(jié)果二4?250,0.10659158,0.10-191803結(jié)果二4?500,0.09553028.0*09411765結(jié)果匕.為山(L03608040,0.O848SO64結(jié)果二弓.000,0.077948Q7J0.07692308四階龍格庫(kù)塔結(jié)果:?LGKTh=0,25i0=0y0=2輸入的萄Hl是:X=0Y=5結(jié)^0,250,1.8823030,1.8823529結(jié)果=0.500,1.5998962,1.6000000結(jié)果=0.750,1.2799478,1.2800000結(jié)果=1.000,L0000271,1-0000000結(jié)果=1.250,0-7805556,0.7804378結(jié)果二1.500j0.6154594j0.6153846Slltl.750,0.4923742:,0.4923077結(jié)果=2.000,0.4000543,0.4000000結(jié)果-2.250,0.3299396,0.3298969結(jié)果=2.500,0.2758952,0.2758621結(jié)果=2.750,0.2336023,0.2335766^^=3,000,0,2000200,0,2000000結(jié)果=3?25Q衛(wèi)17298S6.0,1728730結(jié)果=1500,0.1509558,0-1509434結(jié)果=3-750,0.1327899,0.1327801結(jié)果=4.000,0.1176550,0.1176471結(jié)果=4.250,0.1049245,0.1049180^^4.500,0.0941229,0,0941176結(jié)果=4.750,0.0848850,0.0848806結(jié)果=5.000,0.0769267,0.0769231
?LGKTX1xO=Oy€=2輸入的范園是;1=0Y=5結(jié)果100,1.98019?8,1,9801980結(jié)果=0.200,1.9230763,1.923076&結(jié)果刃*300,1.8348612」.8348624結(jié)果刃.400,L7241364,L724137&結(jié)果二Ck500#1.5999^84,1.6000000結(jié)果=0,60^1.4705870,1*4705802結(jié)果=0.700,1.3422312,L342281&結(jié)果-0.800fL2195122f1.2195122結(jié)果刃*900,1.1049731,L1049724結(jié)果000,1.0000012,1,0000000結(jié)果=1-100,0.9049790,0.9049774結(jié)果=1,200,0,8196739,0.8196721結(jié)果=】*300,0.7434963,0,7434944結(jié)果打*400,0.6756776,0.6756757結(jié)果=1*500,0.6153865,山6153346結(jié)果600,0.5617996,認(rèn)5617978結(jié)果=1.F00?0.5141405,0.5141388結(jié)果=1.800,0,4716997,0,4716981結(jié)果=】*900,0.4338409,0,4338395結(jié)賽2?000,Q.400001%1.4000000結(jié)果=2.100,0.3696870,0-3696858結(jié)果200,0.3424668,仇3424658
結(jié)果啞.300,0.3179660,0.3179650結(jié)果二工400,0.2958589,0.2958580結(jié)果=2.500,0,2*58629,0.2758621結(jié)果弍*600,0.2577327,0.2577320結(jié)果=監(jiān)700,0.2412552,0.^12545結(jié)果=2.800,0.2262449,0.2262443結(jié)果=2.900,0.2125404,0.2125399結(jié)果=J.::\LI.2000uu57':.::'U|jijij0結(jié)果-3.100^0.1835018,0.1885014結(jié)果=3.200,0.1779363,0.1779359結(jié)果=3?300,0.16S2OS9,0.1682086結(jié)果=3.400,0.1592360,0,1592357結(jié)果二3.500」.1609437,0-1509434結(jié)果=3,600,0.143266^0.1432665結(jié)果書(shū)*700,0,1361473,0,136U70結(jié)果=3.800,0.1295330,0.1295337結(jié)果=1900,0.1233808,0,1233806結(jié)果=4.000,0.1176472,0.1176471拮UM?M0.1122966,0,1122965結(jié)果X*200,0.1072963,0.1072961結(jié)果=4.300,0.1026169,0.1026167結(jié)果=4.400,0.0982320,(L0982313結(jié)果=4.500,0.09411F8?O.0941176結(jié)果二4*600,0..0902628,0,0902527結(jié)果二4.7?,0.0866177,0,0866176絃肚4?800,0.0831948,0.0831947^$=4.900,0.0799681,0.0799680結(jié)果翡.000,0.0769232,0,0769231步長(zhǎng)分別為:0.25和0.1時(shí),不冋結(jié)果顯示驗(yàn)證了步長(zhǎng)減少,對(duì)于精度的提高起到很大作用,有效數(shù)字位數(shù)明顯增加。六、 實(shí)驗(yàn)小結(jié):通過(guò)這次實(shí)驗(yàn)學(xué)習(xí),首先第一點(diǎn)對(duì)改進(jìn)歐拉格式和四階龍格庫(kù)塔的原理推導(dǎo)有了深入的理解,改進(jìn)歐拉格式采用(預(yù)報(bào)+校正)模式得到較精確的原函數(shù)數(shù)值解;而四階龍格庫(kù)塔則采用多預(yù)報(bào)幾個(gè)點(diǎn)的斜率值,采用加權(quán)平均作為平均斜率的近似值的思想達(dá)到更高精度的數(shù)值解,二階龍格庫(kù)塔的特例就是改進(jìn)后的歐拉格式。七、 思考題
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 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ì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度個(gè)性化離婚協(xié)議書(shū)制作合同
- 2024微信搖一搖抽獎(jiǎng)活動(dòng)策劃與執(zhí)行合同3篇
- 2025年度物業(yè)保潔服務(wù)及設(shè)施維護(hù)承包合同3篇
- 2024年設(shè)立5G通信技術(shù)分公司合作協(xié)議3篇
- 員工餐桌禮儀培訓(xùn)
- 二零二五年度半股出租車(chē)轉(zhuǎn)讓合同與車(chē)輛更新協(xié)議3篇
- 2024年航空公司與機(jī)場(chǎng)間航空貨運(yùn)代理服務(wù)合同
- 臨床藥師述職報(bào)告
- 2024版砌體合同范本墻體砌筑合同
- 2024年跨境電商平臺(tái)服務(wù)與運(yùn)營(yíng)合同
- 通信安全員ABC證報(bào)名考試題庫(kù)及答案
- 英山縣南河鎮(zhèn)黑石寨飾面用花崗巖礦礦產(chǎn)資源開(kāi)發(fā)利用與生態(tài)復(fù)綠方案
- 開(kāi)放系統(tǒng)10861《理工英語(yǔ)(4)》期末機(jī)考真題及答案(第103套)
- 2023年印尼法律須知
- 20S805-1 雨水調(diào)蓄設(shè)施-鋼筋混凝土雨水調(diào)蓄池
- 《中華民族大團(tuán)結(jié)》(初中)-第7課-共同創(chuàng)造科學(xué)成就-教案
- OptiXOSN3500產(chǎn)品培訓(xùn)課件
- 鋼筋計(jì)量-柱鋼筋計(jì)量之框架柱基礎(chǔ)插筋
- 肌間靜脈血栓護(hù)理問(wèn)題
- (高清版)DZT 0399-2022 礦山資源儲(chǔ)量管理規(guī)范
- 太空艙民宿可行性研究報(bào)告
評(píng)論
0/150
提交評(píng)論