How to code a toggling behavior in ODEs
조회 수: 1 (최근 30일)
이전 댓글 표시
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
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?
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!