How to use figure out steady state during ODE

4 views (last 30 days)
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?

Accepted Answer

Alan Stevens
Alan Stevens on 1 Aug 2021
Try
ix = find(Y(:,1)==max(Y(:,1)),1)
disp(T(ix))
after your plot command.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!