Hello,
I would like to simulate a model with use of DifferentialEquations.jl. I know I can provide an input to the system via anonymous function, but I am not able to approximate such function.
Is there any possible way to provide sampled data with fixed sampling time as an input (N x 1 vector) instead of providing an anonymous function?
EDIT: The original problem was not well defined, I asked about how to provide measured signal (represented as a sampled data) as a input to the system , which led to interpolation of that sampled data.
The correct formulation is that I would like to provide these sampled data as a discrete time signal (the signal is constant between samples - therefore it is piecewise constant control signal)
If you have sampled data of the right-hand side then it should be possible to use any kind of interpolation. For example, if you want to solve \dot x = f(x) and you have sampled data of f, e.g. F_i \approx f( i/N), then it should be doable.
However, if you have only samples of the trajectory, e.g. X_i = x(t_i) for t_i = 0, h, 2h, ... then
what you describe is actually a non-trivial and very active area of research.
The question how to find the ODE model for given data is very closely related to parameter optimisation or regression; and somehow similar to machine learning techniques.
But essentially, you either need a lot of samples or a good idea how the ODE model could roughly look like, otherwise it is just impossible. (The situation is like in statistics or machine learning, either you need a lot of data or a good model, ideally both to get good results.)
I don’t know what your application is, but it could be that time series analysis is more suitable…
Thank you for suggestions. I will definitely check them out.
I have sampled data of the right-hand side, therefore I could use any kind of interpolation as you said.
What kind of variable is your input? What is its role in your problem? I dare to guess (based on some other private discussion we had) that it is actually a control variable.
If I am right, then most often than not this control variable (some might call it manipulated variable) will be periodically produced by a discrete-time (computer) controller. The variable will then be piecewise constant and the simulation should capture this. There was already some discussion of this here:
It is the control input produced by a discrete-time controller based on our discussion.
I tried to find solution on Julia discourse but I missed these topics to be honest.
Thank you, I will check them out and then provide a feedback.
Then I suggest adding an EDIT: ... to your original post, stating that actually piecewise constant control input is considered. Otherwise people willing to help might start adding their advice on how to do interpolation, which is actually not what you need.
I would even feel tempted to reflect this in the title of the post perhaps replacing measured input with piecewise constant control input or digital input or discrete-time input or time-series input something like that. And make a comment on this modification in the EDIT so that the existing responses do not look off the original topic. This way, I believe, the whole topic might serve better not only to you right now but also to other readers searching for this topic in future using keywords. But it is up to you, you can perhaps even leave everything as it is.