Interpolation in the ODE solver

11 visualizzazioni (ultimi 30 giorni)
Iurii Storozhenko
Iurii Storozhenko il 9 Mag 2020
Modificato: Torsten il 8 Lug 2023
I am developing the numerical model of a gearbox. The gearmesh stiffness between the gears is a function of time or shaft position. So, on each iteration step i have to evaluate the value of gearmesh stiffness for ODE solver. I have found two possible ways of how to model this:
  1. To precalculate the gearmesh stiffness and save the values in a look-up table. Then on each iteration step in ODE solver simply interpolate values from the look up table. As I have found this approach is not the best, because interp1 function is not optimal, and slow down the calculation process significantly.
  2. Another approach is to make symbolic fourier series outside of ODE solver and reprsent this series as a function handle. Then this function handle is declared as a global variable. So on each iteration step, the gearmesh stiffness is evaluated in ODE solver. In my understanding this approach should be more fast, but it is not.
Could you please suggest, maybe there are some other ways of how this simulation can be done? Thank you!

Risposta accettata

Ameer Hamza
Ameer Hamza il 9 Mag 2020
Modificato: Ameer Hamza il 9 Mag 2020
If I just have the functions in the form of data points, then I will prefer approach 1. This approach will usually be faster even if you have a mathematical model of the system because interp1() do local interpolation, i.e., for linear interpolation, it only uses two nearest points.
However, if the accuracy is critical, then approach 2 will be preferable. However, if you think that a very dense mesh can accurately model your system, then I still recommend approach 1. A dense mesh will trade-off memory for computation speed.
Any other approach apart from these two will usually lead to a more complicated solution without any significant gain.
  3 Commenti
Noah Cain
Noah Cain il 7 Lug 2023
How can this first solution be done in practice. I similarly would like to be able to interpolate from a table for each time step in and ODE solver however I do not know how this may be done.
Torsten
Torsten il 8 Lug 2023
Modificato: Torsten il 8 Lug 2023
Take a look at the example
ODE with Time-Dependent Terms
under

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by