Why do my identical "Integrator" blocks with the same input give different outputs?

I have two identical "Integrator" blocks in my Simulink model which receive the same input. One is connected to blocks that loop back to the input, and one is just connected to a "Scope" block. The solver I use is the "ode23tb" solver.
I noticed that they give different outputs. However, if I make a change to a block somewhere else in the model, this is resolved.
Why is this?

 Accepted Answer

The cause of this comes from the "ode23tb" solver, where all the states are solved at once using the Jacobian method. If the Jacobian is badly conditioned, this kind of situation can happen due to floating-point round-off. This means that the result of the block gets affected by what other blocks it is connected to. This would also explain why a change in an unrelated part of the model could affect the behaviour.
When this happens, it is likely that both outputs are incorrect due to the badly conditioned Jacobian.
The best way to resolve this is by enabling zero-crossing detection. Alternatively, changing the tolerance of the solver may also resolve the issue.

More Answers (0)

Products

Release

R2023b

Community Treasure Hunt

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

Start Hunting!