Interpolation within ModelingToolkit framework

Many thanks for your help @ChrisRackauckas. The work of the MKT team in this package is fantastic.

Just some constructive feedback. I feel that the @register functionality might be useful to many people. However, a quick search of @register in the search docs bar only leads to Composing Ordinary Differential Equations - Specifying a time-variable forcing function, where it says:

" MTK allows to “register” arbitrary Julia functions, which are excluded from symbolic transformations but are just used as-is. So, you could, for example, interpolate a given time series using DataInterpolations.jl."

From this description, at least for a new user of MTK like me, it is a bit difficult to infer that I can specify some variables as non-symbolic and the remaining as symbolic. I took the liberty of using the example included in the documentation and include a function that interpolates some time-series data with a mix of non-symbolic and symbolic inputs. Here is the code:

using ModelingToolkit
using DifferentialEquations
using DataInterpolations 


@parameters tau
@variables t, x(t), f(t)
D = Differential(t)

function f_interpolate(t, table_t, table_u)

	interpolator = QuadraticInterpolation(table_u, table_t)
	output = interpolator(t)

end

@register f_interpolate(t, table_t::AbstractVector, table_u::AbstractVector)

table_t, table_u = LinRange(0.5, 10.5, 10), randn(10)

@named fol_external_f = ODESystem([f ~ f_interpolate(t, table_t, table_u), D(x) ~ (f - x) / tau])
prob = ODEProblem(structural_simplify(fol_external_f), [x => 0.0], (0.0, 10.0), [tau => 0.75])

sol = solve(prob)
plot(sol, vars=[x, f])
scatter!(table_t, table_u)

Capture3

If you feel this may complement the existing documentation, feel free to add it. Otherwise it is left here so it may help future new users.