蓝云天 发表于 2010-3-11 17:06

请教关于ode45中tspan的步长问题

ode45解方程时tspan中的步长问题。以下述代码为例

func=inline('[-x(2)-x(3);x(1)+0.2*x(2);x(1)*x(3)-5.7*x(3)+0.2]','t','x');
options = odeset('RelTol',1e-6,'AbsTol',1e-6);
=ode45(func,,[-8,0,0.24],options);

第三行中tspan若设置为,即不人为设置步长,那么默认的步长一般是多少呢?这个问题困扰了我好久。因为在下,若改变初值,得到的序列长度会发生变化,这是否说明tspan默认步长不是一定的,而是根据具体的方程和程序而不同呢?如果是这样,那么具体是怎么个变化方法呢?

谢谢!

messenger 发表于 2010-3-11 18:28

ode45是变步长的,具体内容可以参考帮助

蓝云天 发表于 2010-3-14 11:25

没怎么弄明白,help说的不是很清楚啊
tspanA vector specifying the interval of integration, . The solver imposes the initial conditions at tspan(1), and integrates from tspan(1) to tspan(end). To obtain solutions at specific times (all increasing or all decreasing), use tspan = .
For tspan vectors with two elements , the solver returns the solution evaluated at every integration step. For tspan vectors with more than two elements, the solver returns solutions evaluated at the given time points. The time values must be in order, either increasing or decreasing.Specifying tspan with more than two elements does not affect the internal time steps that the solver uses to traverse the interval from tspan(1) to tspan(end). All solvers in the ODE suite obtain output values by means of continuous extensions of the basic formulas. Although a solver does not necessarily step precisely to a time point specified in tspan, the solutions produced at the specified time points are of the same order of accuracy as the solutions computed at the internal time points.
Specifying tspan with more than two elements has little effect on the efficiency of computation, but for large systems, affects memory management.
页: [1]
查看完整版本: 请教关于ode45中tspan的步长问题