Feeding the output of the ODE solver into another script.

1 回表示 (過去 30 日間)
Edward Steen
Edward Steen 2017 年 2 月 17 日
コメント済み: Walter Roberson 2017 年 2 月 18 日
I'm using the ODE45 to solve a system, which is giving me a n by 6 matrix of values. I would like to take the last row of values and feed that into another script, but don't know how to name it or reference it in the other script. How can I do this?

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 2 月 17 日
This is the sort of reason you use functions instead of scripts.
Your existing second script has a variable name that it expects the input to be stored in. Assign the last row of values from the ode45 solutions into that variable name.
  2 件のコメント
Edward Steen
Edward Steen 2017 年 2 月 17 日
Ok, how do you go about assigning a name to the last row of values from the ODE output? Each time ODE 45 is run, the number of rows in the output matrix varies, so I can't name it by row.
Walter Roberson
Walter Roberson 2017 年 2 月 18 日
Star Strider links to the documentation on "end", which is appropriate.
TheResults(end,:)
This is equivalent to
TheResults( size(TheResults,1), :)

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

カテゴリ

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