求解非线性ODE 2.在Matlab中按数字顺序排序

时间:2013-09-16 08:55:43

标签: matlab numeric numerical-methods nonlinear-functions

我的二阶非线性ODE具有三角函数,因此我无法根据二阶导数来表示它。例如:

ay'' + b arctan(y'') + cy' + dy=0
y'(0)=0, y''(0)=0

没有这样的术语,比如 arctan(y'')我可以编写我的ode函数,如

function output=myodefunc(u,t){
  y(1)=u(2);
  y(2)=(-c*u(2)-d*u(1))/m;
  output=y';
}

不幸二阶非线性项(=> b * arctan(y''))让我无法根据y' >。

有没有办法在Matlab中以数字方式解决这样的三角函数?

1 个答案:

答案 0 :(得分:0)

可以在ode函数中使用非线性求解器(fsolve)来评估y'':

function output=myodefunc(u,t){
  y(1)=u(2);
  x0=0;
  x=fsolve('a*x + b*atan(x) + c*u(2) + d*u(1)',x0);
  y(2)=x;
  output=y';
}