欢迎来到天天文库
浏览记录
ID:39598744
大小:258.12 KB
页数:10页
时间:2019-07-07
《常微分方程的数值解法(欧拉法、改进欧拉法、泰勒方法和龙格-库塔法)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、[例1]用欧拉方法与改进的欧拉方法求初值问题在区间[0,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.2028451.2186891011.2443141.259921现用matlab编程,程序如下x0=0
2、;y0=1;x(1)=0.1;y(1)=y0+0.1*2*x0/(3*y0^2);forn=1:9x(n+1)=0.1*(n+1);y(n+1)=y(n)+0.1*2*x(n)/(3*y(n)^2);end;xy结果为x=Columns1through80.10000.20000.30000.40000.50000.60000.70000.8000Columns9through100.90001.0000y=Columns1through81.00001.00671.01981.03911.06381.09321.12671.1634Columns9through101.20281.244
3、3改进的欧拉方法其计算公式为本题的精确解为,可用来检验数值解的精确度,列出计算结果。使用excel表格进行运算,相应如下例一:改进的欧拉法nx预测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.14216580.81.1779651.1792971.179
4、27490.91.2176461.2187061.2186891011.2591031.259931.259921现用matlab编程,程序如下x0=0;y0=1;x(1)=0.1;ya(1)=y0+0.1*2*x0/(3*y0^2);y(1)=y0+0.05*(2*x0/(3*y0^2)+2*x0/(3*ya^2));forn=1:9x(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*ya(n+1)^2));end;xy结果为x=Colu
5、mns1through80.10000.20000.30000.40000.50000.60000.70000.8000Columns9through100.90001.0000y=Columns1through81.00001.00991.02611.04791.07481.10591.14071.1783Columns9through101.21831.2600[例2]用泰勒方法解分别用二阶、四阶泰勒方法计算点=0.1,0.2,…,1.0处的数值解,并与精确解进行比较。解:二阶泰勒方法对于本题故使用excel表格进行运算,相应结果如下nxy精确解001110.11.0033331.00
6、332220.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现用matlab编程,程序如下x0=0;y0=1;x(1)=0.1;y(1)=y0+0.1/(3*y0^2)*(2*x0+0.1*(1-4*x0^2/(3*y0^3)));forn=1:9x(n+1)=0.1*(n+1);y(n+1
7、)=y(n)+0.1/(3*y(n)^2)*(2*x(n)+0.1*(1-4*x(n)^2/(3*y(n)^3)));end;xy结果为x=Columns1through90.10000.20000.30000.40000.50000.60000.70000.80000.9000Column101.0000y=Columns1through91.00331.01321.02931.05101.07761.10841.14
此文档下载收益归作者所有