I have a nonlinear ode system that has a complex structure, modeled with ModelingToolkit
. This system shows a damped oscillatory response and is defined as
@named ode = ODESystem(eqs, t, <variables>, <parameters>, tspan=(0.0, 10.0))
simple_ode = structural_simplify(ode)
which I manage to solve using
prob = ODEProblem(simple_ode, <u0>, (0, 10), ps)
sol = solve(prob, Rodas5(), abstol=1e-8, reltol=1e-8)
Now I know the time response of my system, but I would like to get the state matrix A from it’s linearization around the final position so that I know its stability properties around that point.
I’ve tried a naive (; A, B, C, D), simplified_sys = linearize(simple_ode,[],[],t=last(sol.t),op=last(sol.u)
since I do not care about the inputs and outputs, just the states, but I get a ERROR: ExtraVariablesSystemException: The system is unbalanced
.
It looks like this function tries to re-simplify the system structure, but that goes wrong… and I do not know how to retrieve the state matrix through linearization_function
which has a simplify=false
option (which does not seem available in linearize
)