ode求解器的事件属性
检测事件
matlab微分方程如何设定变量的范围
如
dy1=y2
dy2=y1+1
其中y1的范围为0<y1<=4
【解】
M文件:
function
value
isterminal=
direction
命令窗口:
dy
options=odeset('events',@events1);
[t,y]
plot(t,y)
Description
Events—
[value,isterminal,direction]
value,
-
value(i)
is the value of the it hevent function.
-
isterminal(i)=
1 if the integration is to terminate at a zero of this event function,otherwise, 0.
-
direction(i)
= 0 if all zeros areto be located (the default), -
+1
if only zeros wherethe event function is increasing, -
and
-1 if onlyzeros where the event function is decreasing.
If
-
A
column vector of times at whichevents occur -
Solution
values corresponding to these times -
Indices
into the vector returned by the events function.The values indicate which event the solver detected.
If
[T,Y,TE,YE,IE]
the
If
sol
the
For
........................
编写events.m文件描述需要检测的事件(过零点检测):
function
Y=x(3);
%
%
%
value=Y;
%
%
isterminal=1;
%
%
direction=-1;