Code's improvement (plots animation)
Mostrar comentarios más antiguos
Hi. My intention is creating an animated plot which will represent the trajectory of a body in the space. I have written this code for it. My problem is more simple that it appears. I want to see the movie (the animated plot stored) in the active figure window but I can not. When I maximize the window, I realize it is empty i.e. the movie is not contained.
t = 0:pi/50:10*pi;
x = sin(t);
y = cos(t);
z = t;
xmin = min(x);
ymin = min(y);
zmin = min(z);
xmax = max(x);
ymax = max(y);
zmax = max(z);
fh = figure;
ah = axes('Parent',fh);
N = 101;
for i = uint8(1):uint8(N+1)
delta = (10*pi)/N;
b = delta*(double(i-1));
t = 0:0.01:b;
plot3(ah,sin(t),cos(t),t);
set(ah, 'XLim', [xmin xmax],'YLim', [ymin ymax],'Zlim',[zmin zmax]);
axis square;
pause(0.008);
M(i) = getframe(gcf);
end
cla;
movie(fh,M,1);
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Animation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!