找回密码
 注册
Simdroid-非首页
查看: 248|回复: 8

[图形图像] 四人追逐问题的模拟

[复制链接]
发表于 2010-9-18 11:42:54 | 显示全部楼层 |阅读模式 来自 湖南怀化
这里写了一个小段子模拟四人追逐问题,即四个人各处于正方形的一顶点,以相同的速度相互追逐。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×

评分

1

查看全部评分

发表于 2010-9-19 01:04:42 | 显示全部楼层 来自 台湾
Simdroid开发平台
本帖最后由 chungyuandye 于 2010-9-19 09:34 编辑

n人追逐

  1. equiangular[ntemp_Integer,ttemp_]:=
  2. Block[{n=ntemp,t=ttemp,myarrow,mypoint},
  3. myarrow={Exp[-#(2Pi/n)-Pi*(t-0.005)+#(2Pi/n)]*{Cos[-#(2Pi/n)-Pi*(t-0.005)],Sin[-#(2Pi/n)-Pi*(t-0.005)]},
  4. Exp[-#(2Pi/n)-Pi*t+#(2Pi/n)]*{Cos[-#(2Pi/n)-Pi*t],Sin[-#(2Pi/n)-Pi*t]}}&/@Range[0,n-1];
  5. mypoint=Flatten[{Exp[-#(2Pi/n)-Pi*t+#(2Pi/n)]*{Cos[-#(2Pi/n)-Pi*t],Sin[-#(2Pi/n)-Pi*t]}}&/@Range[0,n-1],1];
  6. Show[Graphics[{Red,PointSize[0.02],Arrow[#]&/@myarrow},
  7. PlotRange->{{-3/2,3/2},{-3/2,3/2}}],
  8. Graphics[Line/@Partition[mypoint,2,1,1]],PolarPlot[{Exp[x+#(2Pi/n)]},{x,-#(2Pi/n),-#(2Pi/n)-Pi*t}]&/@Range[0,n-1],Frame->True]]

  9. Animate[equiangular[5, t], {t, 0.001, 3}]
复制代码


file:///Users/chungyuandye/2.gif

评分

1

查看全部评分

回复 不支持

使用道具 举报

 楼主| 发表于 2010-9-19 10:18:29 | 显示全部楼层 来自 湖南怀化
呵呵,做得不错!
回复 不支持

使用道具 举报

发表于 2010-9-22 12:58:28 | 显示全部楼层 来自 上海
搞的有点意思,写个演示项目嘛,+2 分技术分。
http://demonstrations.wolfram.com/participate.html
回复 不支持

使用道具 举报

发表于 2010-9-22 19:29:40 | 显示全部楼层 来自 上海
本帖最后由 FreddyMusic 于 2010-9-22 19:42 编辑

I made some edit to implement in Manipulate.
It's looks pretty like "Pursuit Curve".
http://mathworld.wolfram.com/PursuitCurve.html


  1. equiangular[n_Integer,t_]:=
  2. Module[{arrow,point},
  3. arrow={Exp[-#(2Pi/n)-Pi*(t-0.005)+# (2Pi/n)]*{Cos[-#(2Pi/n)-Pi*(t-0.005)],Sin[-#(2Pi/n)-Pi*(t-0.005)]},Exp[-#(2Pi/n)-Pi*t+# (2Pi/n)]*{Cos[-#(2Pi/n)-Pi*t],Sin[-#(2Pi/n)-Pi*t]}}&/@Range[0,n-1];
  4. point=Flatten[{Exp[-#(2Pi/n)-Pi*t+# (2Pi/n)]*{Cos[-#(2Pi/n)-Pi*t],Sin[-#(2Pi/n)-Pi*t]}}&/@Range[0,n-1],1];
  5. Show[
  6. Graphics[{Red,PointSize[0.02],Arrow[#]&/@arrow,Blue,Line/@Partition[point,2,1,1]},PlotRange->{{-3/2,3/2},{-3/2,3/2}}],PolarPlot[{Exp[x+# (2Pi/n)]},{x,-#(2Pi/n),-#(2Pi/n)-Pi*t}]&/@Range[0,n-1],Frame->True]];

  7. Manipulate[equiangular[n,t],{n,2,10,1},{t,.01,1.5}]
复制代码


It can be very cool graphics if you are able to change the inital velocity for any direction.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
回复 不支持

使用道具 举报

 楼主| 发表于 2010-9-23 15:06:39 | 显示全部楼层 来自 湖南怀化
版主一加工,就都变漂亮了!
回复 不支持

使用道具 举报

 楼主| 发表于 2010-9-23 15:10:27 | 显示全部楼层 来自 湖南怀化
但存在一点问题,这似并不能模拟真正的n人追逐,因为代表当前人的点并不在代表追逐他的人的轨迹的切方向上,所以不正确!
回复 不支持

使用道具 举报

 楼主| 发表于 2010-9-23 16:40:23 | 显示全部楼层 来自 湖南怀化
版主一加工,就都变漂亮了!
回复 不支持

使用道具 举报

发表于 2012-1-12 20:47:20 | 显示全部楼层 来自 浙江金华
我拿去研究一下,最近可能研究这种模型,生成引擎动画:D
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-4-20 07:15 , Processed in 0.057993 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表