필터 지우기
필터 지우기

How I can understand which event the solver detected during the solution of an ODE?

조회 수: 1 (최근 30일)
Dear community,
I have three ODEs to solve, and each ODE is characterized by more than one stop condition. Consequently, I used event functions to detect when certain stop conditions occur during the solution of an ODE.
To clarify the thinking, I write to you three stop conditions of just one event function.
Consequently I wrote this function
function [value, isterminal, direction] = events3(sol3)
% Termination conditions:
% detect |zd| = 0
% detect theta = 0
% detect |theta| > pi/2
%
% zd = sol3(4)
% theta = sol3(1)
value = [abs(sol3(4)); sol3(1); +(abs(sol3(1)) > pi/2)];
isterminal = [1; 1; 1]; % stop the integration
direction = [0; 0; 0]; % all direction
end
Besides, I need to know which event the solver detected. For this reason, I call ODE solver with three additional output arguments, as
[t,y,te,ye,ie] = odeXY(odefun,tspan,y0,options)
The output ie suits my task. Nevertheless, I don't understand why sometimes it is a vector with one component or with two components. I thought that more than one condition was detected contemporary when it was a vector with two components. But it is not correct, since I saw that the ie vector sometimes has the same components, for instance ie = [1;1].
Could someone help me understand how this output works ?
Kind regards
Califfo

답변 (0개)

카테고리

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

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by