Interpolation in the ODE solver

9 vues (au cours des 30 derniers jours)
Iurii Storozhenko
Iurii Storozhenko le 9 Mai 2020
Modifié(e) : Torsten le 8 Juil 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!

Réponse acceptée

Ameer Hamza
Ameer Hamza le 9 Mai 2020
Modifié(e) : Ameer Hamza le 9 Mai 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 commentaires
Noah Cain
Noah Cain le 7 Juil 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 le 8 Juil 2023
Modifié(e) : Torsten le 8 Juil 2023
Take a look at the example
ODE with Time-Dependent Terms
under

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by