MATLAB ODE45 right hand side function setting some states derivatives equal to zero

2 次查看(过去 30 天)
Dear all,
I have a right hand side function that can be used by the ode solvers in MATLAB. There are many states and some of the states derivatives are set equal to zero during numerical integration due to the physics of the system.
Typically, one would go ahead and remove those states with the derivatives equal to zero from the right hand side function and numerically integrate the reduced system to get the solution (this is computationally cheaper). However, in this case, we want to keep the right hand side function at the same dimension, for the technical reasons (extensive indexings are used in many parts of the large program and it is extremely timetaking to actually rework the indices...).
I am wondering about two points:
  1. How much of a performance hit are we going to have, if we have some entries in the right hand side function with the state derivatives set equal to zero? Will this increase the computational burden substantially?
  2. Is there any other work around to this problem? For instance, can I use a right hand side function with only those states set equal to non-zeros but actually modify the state solution vector at the very first line of the right hand side function so that I can still work with the desired dimension of the states, while making sure that the returned right hand side function is of the right dimension required by the original number of non-zero states?
Thank you so much for your help and have a good weekend!
Sincerely,
Tae
  2 个评论
Torsten
Torsten 2022-2-27
You should keep everything as it is - there won't be a substantial increase in computational burden and modifying the right-hand side during integration will only cause numerical problems.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by