Method of continuousTimeMss.
Integrate a continuous-time mss model as an explicit
ODE.
Source: src/simulator/@continuousTimeMss/simulate.m
An mss state equation is explicit, so the initial value
problem is the plain ODE
integrated over [inputTime(1), inputTime(end)] with the
MATLAB ode object. The solver is taken from
sim.solverType, the option struct is merged in by applySolverOptions,
and solve produces the trajectory that is written to
sim.time and sim.variableTrajectory (states in
rows, time points in columns).
The inputs are not part of the state:
is reconstructed from
inputTime/inputTrajectory by linear
interpolation with linear extrapolation outside the sampled range, so
the solver may step anywhere inside the span.
Explicit Runge–Kutta solvers never evaluate a Jacobian, so the Jacobian handle is attached based on the solver, not the model class.
For
ode45, ode23, ode78, ode89, ode113
no Jacobian is passed to ode; every other
solver (ode15s, ode23t, …) receives the
analytic
i.e. the full signal Jacobian restricted to the state columns, since the solver differentiates with respect to only.
For a CPNTensor
everything that does not depend on
is hoisted out of the callbacks:
CPNTensor.prepareForMTISIM (structure and parameter
matrices sliced to columnIndexStateEq /
stateEquationIndex) and evaluated through the
MTISIM kernel;computeJacobian
— and only when the solver actually needs it;griddedInterpolant objects rather than re-running
interp1 over the whole input matrix per callback;[x; u] layout — what rmss,
ss2mss and connect produce — the scatter into
that buffer becomes two contiguous slice assignments; the check
(strictly ascending, first, last, count) proves the index vectors are
exactly 1:nState and nState+1:nVar, so a
permuted layout never takes the fast path.Any other mtiTensor is evaluated
through the model itself: functionValue
supplies
and stateJacobian
supplies the Jacobian, whose first nState columns are
handed to the solver. The inputs are interpolated with
interp1(..., 'linear', 'extrap').
continuousTimeMss
· applySolverOptions
· functionValue ·
stateJacobian ·
msim
MyToolbox Documentation | Generated automatically by CI/CD pipeline