# Is there a way to incorporate time series data into coupled ODE system using DifferentialEquations.jl?

**URL:** https://discourse.julialang.org/t/is-there-a-way-to-incorporate-time-series-data-into-coupled-ode-system-using-differentialequations-jl/101682
**Category:** Modelling & Simulations
**Tags:** differentialequation
**Created:** [July 16, 2023, 10:31pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-incorporate-time-series-data-into-coupled-ode-system-using-differentialequations-jl/101682 "2023-07-16T22:31:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![PeX](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pex/32/49986_2.png) [@PeX](https://discourse.julialang.org/u/PeX)
#### Post date: [July 16, 2023, 10:31pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-incorporate-time-series-data-into-coupled-ode-system-using-differentialequations-jl/101682/1 "2023-07-16T22:31:05Z")

</div>

Hi all,  
If I have a set of coupled ODE:

x = f(y, \dot{y}, \dot{x}), y = f(x, \dot{x}, \dot{y})

and I have a time series data for x, is there a way to implement this constraint into the solver? I was looking at the docs but couldn’t find a way. maybe I missed it.

Thank you!

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [July 16, 2023, 11:43pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-incorporate-time-series-data-into-coupled-ode-system-using-differentialequations-jl/101682/2 "2023-07-16T23:43:43Z")

</div>

Just make the time series into a function and use it. DataInterpolations.jl is quite useful for that.

> **[GitHub - SciML/DataInterpolations.jl: A library of data interpolation and...](https://github.com/SciML/DataInterpolations.jl)**
>
> A library of data interpolation and smoothing functions - GitHub - SciML/DataInterpolations.jl: A library of data interpolation and smoothing functions

---

<div class="post-metadata">

### Author: ![PeX](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pex/32/49986_2.png) [@PeX](https://discourse.julialang.org/u/PeX)
#### Post date: [July 17, 2023, 12:17am UTC](https://discourse.julialang.org/t/is-there-a-way-to-incorporate-time-series-data-into-coupled-ode-system-using-differentialequations-jl/101682/3 "2023-07-17T00:17:50Z")

</div>

Thank you very much! Do you mind sharing how to implement it as a function? Just by adding it as another equation to the system?

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [July 17, 2023, 2:18am UTC](https://discourse.julialang.org/t/is-there-a-way-to-incorporate-time-series-data-into-coupled-ode-system-using-differentialequations-jl/101682/4 "2023-07-17T02:18:10Z")

</div>

Have a look at [How to linearize a model](https://discourse.julialang.org/t/how-to-linearize-a-model/99886) I created the function `cp` from numerical data and used it in Modelingtoolkit equations…

Yes, you might need another equation…
