MATLAB: How does Simulink compute the integration error
simulinksolver
I would like to see in the documentation an explanation on how Simulink computes the integration error.
Best Answer
Documentation on how Simulink computes the integration error is missing from product and manual.
Here is additional information on this issue:
The solver is doing the necessary computations in 2 ways (2 orders). For example, ODE45 is doing the integrations in order 4 and in order 5, and compares the 2 calculations. If the 2 calculations difference is bigger than the tolerance, it means that the step-size should be reduced.
An order 4 means that the solver is using 4 minor time steps to integrate the data between every 2 major time steps.
Minor time steps occur if your model has continuous states. It occurs during the integration stage of your model. Simulink uses a numerical integration algorithm such as ODE45 to simulate a system. During the integration stage the solver obtains the derivatives from the system and uses it to compute a new state vector for the next time step. This entire process is called the integration phase or minor time step.
Page 3-16 of the Writing S-functions manual (version 3.0) shows a graphical representation of the calling sequence of an S-function which should help to make this more clear. This is also shown here:
Best Answer