How to use ode45 efficiently on a large input vector
4 ビュー (過去 30 日間)
古いコメントを表示
Hello, I am using ode45 to solve a set of coupled ODEs. I need to solve them for >2M points. This is taking a long time (~45 minutes). I was wondering if I could solve the problem faster by dividing my long input vector into many smaller vectors (i.e. of length on the order of 1000) and then "stitching" the results of the ode45 solution together. I am aware that I would need to iteratively update initial conditions as I loop over subsections. However, in principle, would reducing the input vector size and running over many of those result in a speed up?
Alternatively, do you have any other advice on how to speed up the evaluation of ode45 over many points?
3 件のコメント
Bjorn Gustavsson
2022 年 10 月 24 日
To me it seems as if your problem is in that your ode-system have discontinuities whenever you step from one element in Tp to the next, i.e. whenever floor(t/t_step) ticks up. The ode-integrating functions dont like that, they expect the RHS to be continouos and even smooth. Your best approach would be to integrate it step-wise for time-periods with constant Tp.
HTH
回答 (1 件)
Bjorn Gustavsson
2022 年 10 月 21 日
If the ODE-system you're trying to solve is something like a set of independend equations of motion that only couple "pairwise" ( and ) and there are no coupling between the eqs of motion for different particles then it might very well be so that the ode-integration needs to take very short time-steps during one period to get sufficient accuracy for particle i and short time-steps during some other period for particle j. When you integrate all EQs simultaneously short time-steps will be taken for all of the particles every time short time-steps is required for any particle. For this type of problem it can be faster to integrate the equations of motion particle-by-particle. However if all the ODEs couple then this is not a viable route.
HTH
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!