How to code a toggling behavior in ODEs

1 view (last 30 days)
Learner
Learner on 26 Oct 2014
Commented: Learner on 27 Oct 2014
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 Comment
Jan
Jan on 27 Oct 2014
Edited: Jan on 27 Oct 2014
What are "mints"? What are the "ydata for y1"? What are the "xdata"?

Sign in to comment.

Accepted Answer

Jan
Jan on 27 Oct 2014
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?

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!