APP下载

基于MATLAB一阶微分方程的仿真

2021-03-13任春年李会荣魏倩茹

现代信息科技 2021年15期

任春年 李会荣 魏倩茹

摘  要:为得到更加精确的求解微分方程数值解的方法,采用了显式欧拉法、隐式欧拉法、改进欧拉法以及四阶龙格库塔等方法与MATLAB软件中专有的ode45函数作比较,对用不同方法来求解微分方程的求解结果进行了研究,通过例证以及数据分析,得出在步长h任意时,四阶龙格库塔法的精准度、稳定性都要高于其他三种欧拉法,使在微分方程求解方法的选择上更具针对性。

关键词:微分方程;欧拉法;四阶龙格库塔法

中图分类号:TP391.9               文献标识码:A文章编号:2096-4706(2021)15-0160-03

Abstract: In order to obtain a more accurate numerical solution of differential equations, the explicit Euler method, implicit Euler method, improved Euler method and fourth-order Runge-Kutta method are compared with the special ode45 function of MATLAB software. The results of solving differential equations by different methods are studied. Through examples and data analysis, when the step h is arbitrary, the accuracy and stability of the fourth-order Runge-Kutta method are higher than the other three Euler methods, which makes the choice of differential equation solution method more targeted.

Keywords: differential equation; Euler method; fourth-order Runge-Kutta method

0  引  言

微分方程的理论和方法不仅广泛应用于自然科学,在数学研究领域内,通過深研相关文献可知,关于一阶微分方程的各种边值问题已取得不少的研究成果。文献[1-2]中表示欧拉法解微分方程时过程虽简单,但是误差较大。

本文利用显式欧拉法、隐式欧拉法、改进欧拉法、四阶龙格库塔等方法来对一阶微分方程进行求解,通过对比相关数据,分析以上各种方法求解一阶微分方程的优劣势,进一步提高一阶微分方程的求解效率。

1  常微分方程的基本概念

含有未知函数导数(或微分)的方程,称为微分方程,未知函数是一元函数的微分方程称为常微分方程,未知函数是多元函数的称为偏微分方程[3]。

一阶常微分方程初始问题:

其中x0为初始时间(已知常数),y0为初始状态,函数f(x,y)关于y满足利普希茨条件,保证初值问题解的存在且唯一。

2  欧拉法

欧拉法的主要思想是迭代思想,也就是逐次替代,从而求出所需要的解,而且还要达到一定的精准度。……

登录APP查看全文