how can i make a pointer to move in the desired shape? i tried using comet it leaves a tail behind. how can the tail disappear?

apart from comet, what else tool/function can be employed to move a pointer in a desired shape path without showing the path being traced.

 採用された回答

KSSV
KSSV 2016 年 10 月 27 日
編集済み: KSSV 2016 年 10 月 27 日
clc; clear all ;
%data of the problem
t = 0:.01:2*pi;
x = cos(2*t).*(cos(t).^2);
y = sin(2*t).*(sin(t).^2);
% comet(x,y);
for i = 1:length(x)
plot(x(i),y(i),'Or')
axis([min(x) max(x) min(y) max(y)]) ;
drawnow
pause(0.01) ; % if you want to slow the plot
end

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 10 月 27 日
Create a small image of the appropriate shape. Use image() to create an image object for it, and use the AlphaData parameter to make the image transparent in the parts that are outside the cursor.
Now as you go through the loop, do not plot anything: instead, set() the XData and YData properties of the image object. That will move the image.

カテゴリ

ヘルプ センター および File Exchange で Graphics Object Properties についてさらに検索

質問済み:

h b
2016 年 10 月 27 日

編集済み:

2016 年 10 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by