MATLAB Answers

Randomly moving circles in a graph

2 ビュー (過去 30 日間)
faiza gul
faiza gul 2019 年 5 月 1 日
コメント済み: Walter Roberson 2019 年 5 月 4 日
I have created circles by the help of fill command. how can I make them movingly linearly.
fill(xobs(k)+robs(k)*cos(theta),yobs(k)+robs(k)*sin(theta),[1 0 0]);
They can be moving in circular motion.

  0 件のコメント

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2019 年 5 月 1 日
You can record the handles returned by fill(), which will be handles of patch objects. The patch objects that are created will have a Vertices property which will be an N x 2 array. You can change the Vertices property to update the locations, such as
rot = makehgtform('zrotate', 15*180/pi);
V = h.Vertices;
temp = [V,zeros(size(V,1),2)] * rot;
h.Vertices = temp(:,1:2);

  6 件のコメント

表示 3 件の古いコメント
Walter Roberson
Walter Roberson 2019 年 5 月 3 日
Put a
hold on
before the code here, and
hold off
after the "for k" loop.
faiza gul
faiza gul 2019 年 5 月 4 日
the code doesnot recognize 'Vertices' it says Invalid or deleted object. Plus there is no motion in circles. only a single circle is plot
Walter Roberson
Walter Roberson 2019 年 5 月 4 日
Code enclosed to prove that it does work. Also enclosed is a movie with proof that it works.

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by