How can I run a fixed time step NARX through ode45?

2 views (last 30 days)
Hello,
I am trying to let a NARX work as a control predictor for a mass-spring-damper system which requires differential equation to be described (it is therefore solved with ode45). Such NARX must produce an output for each time step, so it is called inside the function that is solved by ode45.
The problem: ode45 works with variable time steps. Therefore the input delays of the NARX belong to inconsistent time positions with respect to the constant time step series used to train the NARX.
How can I solve (or workaround) this problem? Could delay differential equation solver help me? Is there a way to modify the built-in ode45 in the way I need?
Thank you in advance.

Accepted Answer

Enrico Fioresi
Enrico Fioresi on 7 Jun 2023
I just found out that there are these external functions (not built in the latest Matlab versions) that allow you to solve ODEs with fixed time steps (ode1, ... , ode5). I have tested them, and although they take several times longer than ode45 for the same quality result, they work for my problem.
They can be downloaded here.

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!