ode事件函数matlab,ODE 事件位置 - MATLAB & Simulink - MathWorks 中国

限制性三体问题的方程为

f87ad90998027c5ec7bda13afb0a37a9.png

其中

f50b34c47600862d588f5590dc83d9c7.png

前两个解分量是微小物体的坐标,因此针对一个分量绘制另一个分量可以得到物体的轨迹。

orbitode.m 中嵌套的事件函数将搜索两个事件。一个事件查找距离起点最远的点,另一个事件查找宇宙飞船返回到起点的点。即使积分器使用的步长并非通过事件位置确定,也会准确定位事件。在此示例中,指定过零方向的功能非常重要。返回到起点的点和距离起点最远的点具有相同的事件值,并由交叉方向来区分这两个点。为此行为编码的事件函数为

function [value,isterminal,direction] = orbitEvents(t,y)

% dDSQdt is the derivative of the equation for current distance. Local

% minimum/maximum occurs when this value is zero.

dDSQdt = 2 * ((y(1:2)-y0(1:2))' * y(3:4));

value = [dDSQdt; dDSQdt];

isterminal = [1; 0]; % stop at local minimum

direction = [1; -1]; % [local minimum, local maximum]

end

键入 orbitode 以运行该示例。

orbitode

This is an example of event location where the ability to

specify the direction of the zero crossing is critical. Both

the point of return to the initial point and the point of

maximum distance have the same event function value, and the

direction of the crossing is used to distinguish them.

Calling ODE45 with event functions active...

Note that the step sizes used by the integrator are NOT

determined by the location of the events, and the events are

still located accurately.

d6249f0c25ec6172322159b6e646deb2.png

6c99cdb40bc598acb2fb64b7797e6802.png

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值