声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2278|回复: 2

[编程技巧] 请教关于ode45中tspan的步长问题

[复制链接]
发表于 2010-3-11 17:06 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
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);
[t,xa]=ode45(func,[0:0.01:3000],[-8,0,0.24],options);

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

谢谢!
回复
分享到:

使用道具 举报

发表于 2010-3-11 18:28 | 显示全部楼层
ode45是变步长的,具体内容可以参考帮助

评分

1

查看全部评分

 楼主| 发表于 2010-3-14 11:25 | 显示全部楼层
没怎么弄明白,help说的不是很清楚啊
tspanA vector specifying the interval of integration, [t0,tf]. 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 = [t0,t1,...,tf].
For tspan vectors with two elements [t0 tf], 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.
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-19 23:43 , Processed in 0.053354 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表