Using loops for an initial condition change

2 ビュー (過去 30 日間)
Koren Murphy
Koren Murphy 2020 年 8 月 11 日
コメント済み: Koren Murphy 2020 年 8 月 11 日
I am using ode45 to solve a set of differentials. At a particular point in the timespan the conditions need to be set to a fixed value, and the solver restarted to continue to solve.
For example, at time = 24 the y0 must change an be reinstated as the initial value with the ode45 solving from this point onwards.
t = [0 6 12 18 24 30 36 42 48];
y0 = [16; 0.5; 0; 2; 0; 0; 0; 0; 0.25];
[t, y] = ode45 (@solver, t ,y0);

採用された回答

Walter Roberson
Walter Roberson 2020 年 8 月 11 日
編集済み: Walter Roberson 2020 年 8 月 11 日
Break it up into two callsz one with timespan ending at that time, and the second starting from that time. Copy the end boundary conditions from the first call, make any necessary adjustments to that, and pass that in to the second call as the initial conditions.
  1 件のコメント
Koren Murphy
Koren Murphy 2020 年 8 月 11 日
Thank you for your help

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by