Use RelTol for relative accuracy and AbsTol for small solution components. Use InitialStep, MaxStep, and MinStep to bound the adaptive step controller.
| Option | Effect | Typical use |
|---|---|---|
| RelTol | Scales the local error test with the solution size. | Primary accuracy control. |
| AbsTol | Sets a floor for small solution components. | Protects variables near zero. |
| NormControl | Uses a vector norm in the adaptive error test. | Coupled systems with shared scale. |
| Stats | Reports solver counters. | Diagnostics and regression tests. |
Set Stats to on to display integration counts, or read the stats field from a solution structure.
loose = odeset('RelTol', 1e-3, 'AbsTol', 1e-6);
tight = odeset('RelTol', 1e-6, 'AbsTol', 1e-9);
solLoose = ode45(@(t,y) y, [0 1], 1, loose);
solTight = ode45(@(t,y) y, [0 1], 1, tight);
[solLoose.stats.nsteps solTight.stats.nsteps]
options = odeset('Stats', 'on', 'MaxStep', 0.1);
[t, y] = ode45(@(t,y) -y, [0 1], 1, options);
| Version | Description |
|---|---|
| 2.0.0 | initial version |