欢迎来到天天文库
浏览记录
ID:77803879
大小:18.80 KB
页数:6页
时间:2022-01-28
《常微分方程的数值解法(欧拉法、改进欧拉法、泰勒方法和龙格库塔法)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、页眉内容[例1]用欧拉方法与改进的欧拉方法求初值问题在区间[0,1]上取h0.1的数值解。[解]欧拉方法的计算公式为使用excel表格进行运算,相应结果如下例一:欧拉法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.20284
2、51.2186891011.2443141.259921现用matlab编程,程序如下x0=0;y0=1;x(1)=0.1;y(1)=y0+0.12x0/(3y0A2);forn=1:9x(n+1)=0.1(n+1);y(n+1)=y(n)+0.12x(n)/(3y(n42);end;xy结果为x=页眉内容Columns1through80.10000.20000.30000.40000.50000.60000.70000.8000Columns9through100.90001.0000y=Columns1t
3、hrough81.00001.00671.01981.03911.06381.09321.12671.1634Columns9through101.20281.2443改进的欧拉方法其计算公式为本题的精确解为y(x)31x2,可用来检验数值解的精确度,列出计算结果。使用excel表格进行运算,相应如下例一:改进的欧拉法nx预测y校正y精确解0011110.111.0033331.00332220.21.0099561.013181.01315930.31.0261691.0291711.02914240.41.
4、0480541.0507511.05071850.51.0749041.0772521.07721760.61.1059761.1079651.10793270.71.1405491.1421941.14216580.81.1779651.1792971.17927490.91.2176461.2187061.2186891011.2591031.259931.259921现用matlab编程,程序如下x0=0;y0=1;x(1)=0.1;ya(1)=y0+0.12x0/(3y0A2);y(1)=y0+0.05
5、(2x0/(3y0A2)+2x0/(3yaA2));forn=1:9x(n+1)=0.1(n+1);ya(n+1)=ya(n)+0.12x(n)/(3ya(n)A2);页眉内容y(n+1)=y(n)+0.05(2x(n)/(3y(n)A2)+2x(n+1)/(3ya(n+142));end;xy结果为x=Columns1through80.10000.20000.30000.40000.50000.60000.70000.8000Columns9through100.90001.0000y=Columns1th
6、rough81.00001.00991.02611.04791.07481.10591.14071.1783Columns9through101.21831.2600[例2]用泰勒方法解分别用二阶、四阶泰勒方法计算点xn=0.1,0.2,…,1.0处的数值解,并与精确解进行比较。解:二阶泰勒方法对于本题故使用excel表格进行运算,相应结果如下nxy精确解001110.11.0033331.00332220.21.0132231.01315930.31.0292911.02914240.41.0509691.0
7、5071850.51.0775751.07721760.61.1083881.10793270.71.1427041.14216580.81.1798781.17927490.91.219341.2186891011.2606011.259921现用matlab编程,程序如下x0=0;y0=1;x(1)=0.1;y(1)=y0+0.1/(3y0A2)(2x0+0.1(1-4x0A2/(3y0A3)));forn=1:9x(n+1)=0.1(n+1);y(n+1)=y(n)+0.1/(3y(n)A2)(2x(n)
8、+0.1(1-4x(n)A2/(3y(n)A3)));end;xy结果为x=Columns1through90.10000.20000.30000.40000.50000.60000.70000.80000.9000Column101.0000y=Columns1through91.00331.01321.02931.05101.07761.10841.14271.17991.2193
此文档下载收益归作者所有