How to use figure out steady state during ODE

조회 수: 4 (최근 30일)
Heejun Lee
Heejun Lee 2021년 8월 1일
답변: Alan Stevens 2021년 8월 1일
This is the code I am using
//
opts = odeset('MaxStep', 1);
[T,Y] = ode45(@hw0,[0 100],[0.01 10], opts);
plot(T,Y)
//
And hw0 is the funcion following below
//
function dy = hw0(t,y)
D=0.02;
um=0.2;
Ks=0.05;
X0=0.01;
S0=0.1;
Sf=10;
dy = zeros(2,1);
dy(1) = -D*y(1) + (um*y(1)*y(2))./(Ks+y(2));
dy(2) = Sf * D - D*y(2) - (um*y(1)*y(2))./(0.4*(Ks+y(2)));
//
What I want to do is find point t
when Y(i,1)-Y(i+1,1)<0.0001
% when numerical difference between one step is smaller than 0.0001
How can I find the point t?

채택된 답변

Alan Stevens
Alan Stevens 2021년 8월 1일
Try
ix = find(Y(:,1)==max(Y(:,1)),1)
disp(T(ix))
after your plot command.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by