How to use figure out steady state during ODE

1 次查看(过去 30 天)
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