我正在考虑一个集成问题,直到在 Matlab 中使用 ode45 发生事件,如下所示:http: //www.mathworks.com/help/techdoc/math/f1-662913.html#f1-670140
有没有办法控制 Matlab 计算事件位置的准确度?更具体地说,这些事件告诉您在 ODE 上求解,直到找到value
参数的零,但是 有多小value
?有没有办法指定value
集成终止时我想要多小?
我正在考虑一个集成问题,直到在 Matlab 中使用 ode45 发生事件,如下所示:http: //www.mathworks.com/help/techdoc/math/f1-662913.html#f1-670140
有没有办法控制 Matlab 计算事件位置的准确度?更具体地说,这些事件告诉您在 ODE 上求解,直到找到value
参数的零,但是 有多小value
?有没有办法指定value
集成终止时我想要多小?
Is there a way to control how accurately Matlab computes the event location?
The short answer appears to be "no, but it's at machine precision anyway". Matlab's ode45
(and the rest, like ode15s
, ode23
, etc.) calls a function called odezero
, which does the work of computing the zero events of the ODE integrators. Here are the relevant lines in odezero
where the tolerance is set:
tol = 128*max(eps(t),eps(tnew));
tol = min(tol, abs(tnew - t));
From this, you can see two things: (1) there is no dependence on any user options and (2) even if you had control, you couldn't set it any smaller because the tolerance is 128*eps.
Is there a way to specify how small I want value to be when the integration terminates?
Matlab's ODE event detectors don't look for value
going to zero or getting close to zero, it looks for it crossing zero. If you want to look for a particular value of the ODE crossing a certain value, then have the event function return the difference between the solution and the desired threshold.