Using Simulink | ![]() ![]() |
Improving Simulation Accuracy
To check your simulation accuracy, run the simulation over a reasonable time span. Then, reduce either the relative tolerance to 1e-4 (the default is 1e-3) or the absolute tolerance and run it again. Compare the results of both simulations. If the results are not significantly different, you can feel confident that the solution has converged.
If the simulation misses significant behavior at its start, reduce the initial step size to ensure that the simulation does not "step over" the significant behavior.
If the simulation results become unstable over time:
ode15s
, you may need to restrict the maximum order to 2 (the maximum order for which the solver is A-stable) or try using the ode23s
solver.If the simulation results do not appear to be accurate:
![]() | Speeding Up the Simulation | Running a Simulation from the Command Line | ![]() |