I made a 2D color plot, how do I turn the plot into an animation or video of the points being put into place? Thanks
1 回表示 (過去 30 日間)
古いコメントを表示
The plots differ in color based on the Z value.
0 件のコメント
回答 (5 件)
Image Analyst
2013 年 7 月 17 日
Have you tried the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_create_a_movie_from_my_MATLAB_figures.3F
0 件のコメント
Youssef Khmou
2013 年 7 月 17 日
hi,
If you mean you have a plot from 2 vectors x and y, then you can use the function pause to drawn each point :
for n=1:length(x)
plot(x(n),y(n))
pause(N), % where N is numbers of seconds
hold on,
end
Here is an example from my File Exchange : http://www.mathworks.com/matlabcentral/fileexchange/41579-projectile-motion-in-weak-gravitational-fieldg=3-71-ms%C2%B2
0 件のコメント
Shane
2013 年 7 月 18 日
編集済み: Shane
2013 年 7 月 18 日
The comet function is also quite nice.
X = sin(0:.01:2*pi);
comet(X)
%or
X = sin(0:.01:2*pi);
Y = 0:.01:2*pi;
comet(X,Y)
1 件のコメント
Image Analyst
2013 年 7 月 18 日
Yes, though it could be even better if there were some way to control the speed of the comet and length of the tail.
Ricardo A. Baila
2016 年 7 月 6 日
You might want to check out:
doc animatedline
Example from the documentation:
Create the initial animated line object. Then, use a loop to add 1,000 points to the line. After adding each new point, use drawnow to display the new point on the screen.
h = animatedline;
axis([0,4*pi,-1,1])
x = linspace(0,4*pi,1000);
y = sin(x);
for k = 1:length(x)
addpoints(h,x(k),y(k));
drawnow
end
(And you can control the drawing speed up to a certain degree by resourcing to the pause command)
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!