Most effective way to fix axes for 3-D animation

Hello, I have some data that I would like to animate. The code is below:
The vectors x(:,i), y(:,i), and z(:,i), are the coordinates of various points in space, where i is the ith frame of the animation; the value x(j,i) would be the jth point in the ith frame of the animation. All points are plotted simultaneously.
for i = 1:size(x,1)
plot3(x(:,i), y(:,i), z(:,i), 'go'); axis(axislimits);
set(gca,'Color',[0.1 0.1 0.1],'Xcolor',[1 1 1],'Ycolor',[1 1 1],'Zcolor',[1,1,1]);
axis square; grid on; pause(1/60);
end
Is there a way to set the axis properties, so that MATLAB won't have to redraw it every time it goes through the loop?

 Respuesta aceptada

per isakson
per isakson el 27 de Abr. de 2012
In the loop you only need to update the the XData, YData and ZData. Something like
for ii = 1 : size( x, 2 )
set( graphic_handle, 'XData', x(:,ii), 'YData', y(:,ii), 'ZData', z(:,ii) )
pause(1/60)
end
See: Lineseries Properties

Más respuestas (0)

Categorías

Más información sobre Animation en Centro de ayuda y File Exchange.

Preguntada:

el 27 de Abr. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by