필터 지우기
필터 지우기

How can I plot ode 45 for different values of a constant after specific time?

조회 수: 2 (최근 30일)
I want to change the value of del after given time interval.
T = 1:1:3500;
del = 0; % For T=1:1:3100
del = 1; % For T=3100:1:3500
[t,y] = ode45(@f_1,T,C);
This is the only line of the function which contains del.
dy(4,1)=(y(1)*k(1))/V(4) - (y(4)*(k(1) + k(2) + k(3) + del*k_clear))/V(4) + (y(2)*k(2))/V(4) + (y(3)*k(3))/V(4);
I want to plot this graph
But was able to construct this.
  댓글 수: 1
madhan ravi
madhan ravi 2019년 2월 4일
편집: madhan ravi 2019년 2월 4일
Share your ode function.Why not?
function dydt = myod(t,y)
.....
if t <= 3100
del = 0;
else
del = 1;
end
.... rest of the code
end

댓글을 달려면 로그인하십시오.

채택된 답변

Torsten
Torsten 2019년 2월 4일
편집: Torsten 2019년 2월 4일
function main
T = 1:1:3100;
del = 0.0;
[t1,y1] = ode45(@(t,y)f_1(t,y,del),T,C);
T = 3100:1:3500;
del = 1.0;
C = y1(end,:);
[t2,y2] = ode45(@(t,y)f_1(t,y,del),T,C);
t = [t1;t2];
y = [y1;y2];
plot(t,y)
end
function dy = f_1(t,y,del)
...
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by