Borrar filtros
Borrar filtros

Interpolation in the ODE solver

30 visualizaciones (últimos 30 días)
Iurii Storozhenko
Iurii Storozhenko el 9 de Mayo de 2020
Editada: Torsten el 8 de Jul. de 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!

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 9 de Mayo de 2020
Editada: Ameer Hamza el 9 de Mayo de 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 comentarios
Noah Cain
Noah Cain el 7 de Jul. de 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 el 8 de Jul. de 2023
Editada: Torsten el 8 de Jul. de 2023
Take a look at the example
ODE with Time-Dependent Terms
under

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by