, , . , , .. . , ( - ) , . , value = Lorenz(t,x), ODE , x(3). .
:
function [value,isterminal,direction] = event(t,x)
b = 8/3;
value = x(1)*x(2)-b*x(3); % The third equation from Lorenz(t,x)
isterminal = 0;
direction = -1;
, :
function [value,isterminal,direction] = event(t,x)
y = Lorenz(t,x); % Evaluate all three equations to get third one
value = y(3);
isterminal = 0;
direction = -1;
, :
function [value,isterminal,direction] = event(t,x)
value = Lorenz(t,x);
isterminal = [0;0;0];
direction = [-1;-1;-1];
, , xm. , , , isterminal 1 xm.
, :
r = 15;
sigma = 10;
b = 8/3;
f = @(t,x)Lorenz(t,x,r,sigma,b);
I = [1;5;10];
options = odeset('Events',@(t,x)event(t,x,b));
[t,x,tm,xm,ie] = ode45(f,[0;10],I,options);
:
function X = Lorenz(t,x,r,sigma,b)
...
function [value,isterminal,direction] = event(t,x,b)
...