フィルターのクリア

Using event function in matlab ode45 for multi-dimensional state vector

3 ビュー (過去 30 日間)
Sathish Kumar
Sathish Kumar 2014 年 4 月 2 日
回答済み: Steven Lord 2018 年 7 月 6 日
Hello, I have a set of odes written in matrix form as Xdot = AX; I also have a desired value of the states X_des. X is a five dimensional vector. I want to stop the integration after all the states reach their desired values (or atleast close to them by 1e-3). How do I use event function in matlab to do this? (All the help I have seen are about 1 dimensional states)
PS: I know for sure that all the states approach their desired values after long time. I just want to stop the integration once they are 1e-3 within the desired values.

回答 (1 件)

Steven Lord
Steven Lord 2018 年 7 月 6 日
For the original question, consider the maximum difference between the current state and the desired steady state. When that maximum difference crosses your "close enough" threshold of 1e-3 in a downward direction, stop. Since the maximum difference is less than 1e-3, so are all the others.
For the new question asked by max gilles, the Events function can return a vector. See for example the orbitode example. In that case only one of the events is terminal, the other is simply logged and used to plot maximum distance after the ODE solver has completed its work.

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by