How to rotate an arrow in animation?
9 ビュー (過去 30 日間)
古いコメントを表示
I am trying to create an animation showing the rotation of an arrow about the centre. The arrow is to rotate 360 degree. Which function do I have to use to show the animation? The code is given below:
if true
clc; close all;clear all;
t = 0: (2*pi) / 100: 2*pi; %Creating points
a = cos(t) + sin(t)*i; %Finding the points
compass(a); %Creating the arrow
end
0 件のコメント
採用された回答
Bob Blaine
2017 年 12 月 18 日
Hi Shuvagata,
MATLAB graphics doesn't directly have an animation function, but a fairly simple 'for' loop can be implemented to do animations:
if true
clc; close all;clear all;
t = 0: (2*pi) / 100: 2*pi; %Creating points
a = cos(t) + sin(t)*i; %Finding the points
for i=1:size(a,2)
compass(a(i));
drawnow;
end
The important part is to do the drawnow in the loop, so your graphics changes show up. Hope that helps.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Animation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!