How to code a toggling behavior in ODEs

4 ビュー (過去 30 日間)
Learner
Learner 2014 年 10 月 26 日
コメント済み: Learner 2014 年 10 月 27 日
Hi,
What I am trying to do is that, suppose I have 3 ODEs, i.e:
dy1/dt = (c1*y1*y2) + (c2*y2) - (c3*y3);
dy2/dt = (c3*y3) + (c4*y1);
dy3/dt = (c1*y1) - (c5*y2) + (c3*y3);
I have y4 as well. But this y4 is not interfering till 9th mint of simulation.
dy1/dt = (c1*y1*y2) + (c2*y2) - (c3*y3) + (c2*y4);
dy2/dt = (c3*y3) + (c4*y1);
dy3/dt = (c1*y1) - (c5*y2) + (c3*y3) + (c8*y2*y3*y4);
dy4/dt = -(c6*y3) -(c7*y1*y2*y3)
Suppose it (i.e. simulation of y1, y2 & y3) is giving some finite value at 9th mint. Now at 10th mints, I want my system to toggle the value of y1 from original finite value to some another finite value, and include y4 (like disturbance) automatically to simulation.
Note: As you can see now dy1 and dy3 has one new component with old ones.
The data value are as follows for 1st system (i.e. when y1, y2 & y3 are running)
xdata = [0 1 2 3 4 5 6 7 8 9];
ydata (for y1) = [3 17 9 4 8 2 4 4 4 4].
Now xdata continues (after inclusion of y4):
xdata = [10 11 12 13 14 15 16 17 18 19];
ydata (for y1) = [0.01 0.03 0.05 0.07 0.1 0.08 0.06 0.06 0.06 0.06]
I don't know how can I do that, please help me out.
Thanks in advance.
  1 件のコメント
Jan
Jan 2014 年 10 月 27 日
編集済み: Jan 2014 年 10 月 27 日
What are "mints"? What are the "ydata for y1"? What are the "xdata"?

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

採用された回答

Jan
Jan 2014 年 10 月 27 日
When "mints" are "minutes", it seems trivial: Simply integrate the ODE until the timeof the changed and use the final values as initial values plus the new component for the next integration with the new function including dy4.
This seems to be a direct and easy approach. So what is the actual problem?
  1 件のコメント
Learner
Learner 2014 年 10 月 27 日
I got what you meant.
Thanks.

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

その他の回答 (0 件)

カテゴリ

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