フィルターのクリア

Order of the Matlab Ode Solutions Appearing at Output?

1 回表示 (過去 30 日間)
S H
S H 2019 年 1 月 11 日
コメント済み: Steven Lord 2019 年 1 月 14 日
When solving higher order differential equations using an ode solver (for example [t,y]=ode15i...), there are many outputs in y such as v1(t), v2(t), v3(t), Dv2t(t), Dv3t(t), Dv4t(t).
How do these signals appear at output (y) of the ode solver? What is their order?
In other words, what should I expect to get at y(:,1), y(:,2),...,y(:,end)?

採用された回答

Stephan
Stephan 2019 年 1 月 11 日
編集済み: Stephan 2019 年 1 月 11 日
Hi,
unfortunally Matlab sometimes changes the order of outputs to an order which appears not be logical (at least for me). I dont know why this happens, but it does in some cases. For ODE's it is a good idea to call odeToVectorField with two output arguments like shown here. The order of new_vars is corresponding to the output arguments of y, if you use matlabFunction to create the function handle.
In case of DAE the usage of reduceDAEIndex needs two output arguments which are new_eqs and new_vars. The usage of daeFunction needs both inputs, so that i would expect the order of the input vector for new_vars as the order of the output. But to be honest, for DAE i have no experiences.
Best regards
Stephan
  1 件のコメント
S H
S H 2019 年 1 月 13 日
I had the same observation that each ode sometimes generate results with different orders. Thank you for clearing my doubts.

サインインしてコメントする。

その他の回答 (1 件)

Steven Lord
Steven Lord 2019 年 1 月 13 日
If you're solving ODEs using ode15i or any of the numeric ODE solvers in MATLAB, the order of the solutions in the y output (or the y field of the sol output) should not change. They should be in the same order as the input y that the ODE solver passes into your ODE function.
If you're solving ODEs using dsolve from Symbolic Math Toolbox, see the "Assign Outputs to Functions or Variables" section of the documentation page for dsolve. In this case I recommend calling dsolve with one output and retrieving the solutions from the appropriate fields of that struct array. This avoids needing to worry about the order in which symvar orders the variables.
  2 件のコメント
S H
S H 2019 年 1 月 14 日
Hummm...okay I will check my codes again. Thanks.
Steven Lord
Steven Lord 2019 年 1 月 14 日
If you see this type of behavior from the numeric ODE solvers, please either show a small section of code that demonstrates the behavior or send such a section of code to Technical Support using the Contact Us link in the upper-right corner of this page.

サインインしてコメントする。

カテゴリ

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