How do ODE solvers compute error?

7 次查看(过去 30 天)
MATLAB documentation on odeset says that the solvers follow the rule e(i) ≤ max(RelTol*abs(y(i)),AbsTol(i)). My question is how does MATLAB compute e(i)? Since error is the difference between true and measured (or computed) value, how does MATLAB know the 'true' value of the solution at ith step?

回答(1 个)

Jan
Jan 2011-10-5
The true error between the calculated and the "real" trajectory cannot be computed. This is impossible even in theory, because the initial conditions cannot be determined 100% exactly.
The e(i) error is the difference between the two different discrtization schemes. E.g. ODE45 calculates one Runge-Kutta-scheme of order 4 and one of order 5. Then the difference between them can be used to estimate the local discretization error in the i-th step e(i).
The ODE solver tries to keep the e(i) a little bit smaller than the defined tolerances. If the step size is chosen much smaller, e(i) gets smaller also, but the larger number of steps let increase the global error due to the accumulation of rounding errors.
The explicite implementation of measuring the local discretization error and the definition of "a little bit" is magic, this means: there is no best method in general and no hard mathematical definition. E.g. is the elements of the vector y differs by several magnitudes, or one component of y differs by several magnitudes during the integration. Some integrators use the Wronski-matrix (the sensitivity to the initial conditions) to control the local discretization error. But even this methods needs the manual setting of some magic constants and a good choice of the scaling method.
  5 个评论
Walter Roberson
Walter Roberson 2015-8-24
You could copy the file and edit it however you like. For example you could make the err available to the event functions, and then use the 5 output form of the modified ode45
adil abdukeram
adil abdukeram 2015-8-24
thank you very much, i will try this!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by