且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MATLAB中的ode求解器事件位置索引

更新时间:2022-02-23 21:35:46

实际上,我注意到当模拟由于终端事件而停止然后再从停止的相同点(初始时间和条件)。

Actually, I noticed that this happens when the simulation stops due to a terminal event and then starts again from the same point (initial time and conditions) that stopped.

从技术上讲,由于算术运算初始条件下的准确性MATLAB重新检测到之前停止的相同事件。 MATLAB无法区分这一点,但它被编程为不停止在第一个成功步骤之后发生的终端事件中(参见 odezero 函数参考)。但它确实记录了这个事件。

Technically, due to arithmetic inaccuracies in the initial conditions MATLAB re-detects the same event that made it previously stop. MATLAB is incapable of distinguishing this, BUT it is programmed NOT to stop in terminal events that occur just after the first successful step (see odezero function for reference). It does record the event, though.

因此,下次由于终端事件而停止颂歌时,附加和新索引的时间(以及为什么)是一个包含两个元素的向量。

Consequently, the next time that the ode stops due to a terminal event, the ie is appended with the new index and that's when (and why) ie is a vector with two elements.