How to create a trajectory animation?

1 view (last 30 days)
Enrique Rondán
Enrique Rondán on 9 Jan 2018
How can i create an animation where i represent the trajectory of a point with 200 points, for example, and from there, by each point of the trajectory that is aggregated, i clear the first drawn point. So that it always has the same represented numbers of points in the figure. The code is the following:
imax=size(TrompoX, 2);
iframe=1;
irep=200;
size_mov=floor(imax/10);
movimiento = struct('cdata', cell(1,size_mov), 'colormap', cell(1,size_mov));
for ii=0:201:floor(imax)
clf
for jj=1:irep
plot(TrompoX(ii+jj), TrompoY(ii+jj),'*r')
hold on
axis([150 300 150 300])
movimiento(iframe)=getframe;
iframe=iframe+1;
end
end
But with this what i've achieved is to represent until 200 points and after that it deletes everything and keeps drawing the following 200 points and deletes everything again until there aren't more points.
Thanks a lot in advance for your help.

Answers (0)

Categories

Find more on Animation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!