School Project

1 次查看(过去 30 天)
Zach
Zach 2011-5-12
Hi I'm doing a school project who's end goal is to take randomly placed 'agents' and eventually get them to follow each other in a circle at constant velocity. I've been running a GUI to implement it using vectors to describe the 'agents' (I have two 1x10 vectos, x and y) each (x(i),y(i)) pair describes an agent and I use scatter(x,y) to plot it. I was wondering if there was a simple way to ensure that the 'agents stay within a square area instead of wandering anywhere. Ideally I would like then to wrap around to the other side of the plot.
  2 个评论
Matt Fig
Matt Fig 2011-5-12
Could you give a small example of what you mean. Give a wandered coordinate and the limited coordinate you would like it to transform to in your code.
Zach
Zach 2011-5-16
My grid is goes from 0-50 in the x direction and 0-50 in the y direction. I wrote a code so that it comes back inside the grid, but I don't know how to keep my axes set from 0-50 now.

请先登录,再进行评论。

采纳的回答

Sean de Wolski
Sean de Wolski 2011-5-16
doc axis
Specifically
axis([0 50 0 50])

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by