MATLAB: Does the C-MEX S-function macro ssSetSolverNeedsReset recompute the Jacobian when the ode23tb solver reset event occurs

odeode23sode23tode23tbsimulink

I am writing a C-MEX S-function and under certain conditions I am using a call to the macro ssSetSolverNeedsReset to reset the solver. I would like to know if this macro also forces a recomputation of the Jacobian or not.

Best Answer

How Simulink resets the solvers (ode23s, ode23t and ode23tb) depends on the Configuration Parameter setting of Solver Reset Method. This can take one of two values "Fast" or "Robust". The Robust reset method will recompute the Jacobian at every solver reset event. The Fast method however, does not recompute the Jacobian at solver reset.
In a C-MEX S-function, a call to ssSetSolverNeedsReset will in turn call the appropriate reset algorithm as specified in the Configuration Parameters (either Robust or Fast). Depending on that setting, a decision will be made on whether the Jacobian is recomputed. Thus, ssSetSolverNeedsReset does not determine recomputation of the Jacobian. Instead, the configuration parameter setting does.
Related Question