二元二阶常微分方程组求解

二元二阶常微分方程组的求解,可以用龙格-库塔法求解其数值解。

求解方法:

1、自定义二元二阶常微分方程组降价函数

2、确定初始条件,x1(0)=0,dx1(0)/dt=0,x2(0)=0,dx1(0)/dt=0

3、确定时间t的范围,t【0,10】

4、确定时间t的步长,h=0.1

5、使用runge_kutta龙格-库塔法函数或ode45函数,求解其数值解

6、绘制x1(t)和x2(t)曲线图

x0=[0;0;0;0];

a=0;b=10;h=0.1;

[t,x]=runge_kutta(@func,x0,h,a,b);

plot(t,x(:,1),t,x(:,3));

gridon

xlabel('t'),ylabel({'x1';'x2'})

h=legend('x1(t)','x2(t)','Location','northwest');

运行结果

其他文章