MTK: interpolation of observed variables?

Suppose I do a simulation of a model using ModelingToolkit.jl, where x is the state, y is an observed variable, and the solution object is sol. Then

sol[x]
sol[y]

give vectors of the solution of x and y at the time points given by sol.t (or: sol[t]).

Suppose I instead want an interpolation value?

sol(0.5)

gives the interpolated value of x at time t=0.5.

  • How can I get an interpolated value of y?

sol(0.5; idxs = y)

1 Like