What happens if I set both RelTol and AbsTol for ODE45 and/or both TolX and Tolfun for FSOLVE?

1 次查看(过去 30 天)
I'm solving an eigenvalue problem via a combination of ODE45 and FSOLVE, and I'm not sure what happens if I set both RelTol and AbsTol for the former and both TolX and Tolfun for the latter. Do these functions refine steps, etc. until both requirements are satisfied or only one of them?

回答(1 个)

Torsten
Torsten 2025-1-26
编辑:Torsten 2025-1-26
Do these functions refine steps, etc. until both requirements are satisfied or only one of them?
Both.
Read about error control for ode45 here
and for fsolve here
But you should start with the default settings - a reasonable specification is sometimes subtle, especially if two solvers interact.
  3 个评论
Eugene Benilov
Eugene Benilov 2025-1-26
编辑:Eugene Benilov 2025-1-26
I might add that I ran some experiments (by solving the equation x^2-1=0 with various values of TolX and TolFun) -- and the results suggest it's either/or, but I'd like to be sure.
Torsten
Torsten 2025-1-26
I might add that I ran some experiments (by solving the equation x^2-1=0 with various values of TolX and TolFun) -- and the results suggest it's either/or, but I'd like to be sure.
I agree (see the text in italics):
From the documentation:
TolFunTermination tolerance on function value
1e-4 (default) | nonnegative scalar
Termination tolerance on the function value, specified as the comma-separated pair consisting of 'TolFun' and a nonnegative scalar. Iterations end when the current function value differs from the previous value by less than TolFun, relative to the initial function value.
TolXTermination tolerance on x, the current point
1e-4 for fminbnd and fminsearch, eps for fzero, 10*eps*norm(c,1)*length(c) for lsqnonneg (default) | nonnegative scalar
Termination tolerance on x, the current point, specified as the comma-separated pair consisting of 'TolX' and a nonnegative scalar. Iterations end when the current point differs from the previous point by less than TolX, relative to the size of x.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by