Interpolation in the ODE solver

9 次查看(过去 30 天)
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!

采纳的回答

Ameer Hamza
Ameer Hamza 2020-5-9
编辑:Ameer Hamza 2020-5-9
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 个评论
Noah Cain
Noah Cain 2023-7-7
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 2023-7-8
编辑:Torsten 2023-7-8
Take a look at the example
ODE with Time-Dependent Terms
under

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by