Borrar filtros
Borrar filtros

Capture frames from 3D comet plot to make a movie

4 visualizaciones (últimos 30 días)
Ram
Ram el 29 de Ag. de 2012
Hello,
I am looking to capture frames from a comet plot and then stitch the frames together to form a movie. Can someone please help me?
Here is what I tried. I opened up comet3.m and I added the line 'M(iframe) = getframe' after the 'drawnow' command in the grow the body, primary loop, and clean up the tail segments. iframe is a counter that I increment inside the for loop in those segments. What happens is that the comet plot displays only the current position of the comet and does not display the previous pathways (which is undesirable).
Any help will be greatly appreciated.
Thanks

Respuesta aceptada

Kevin Claytor
Kevin Claytor el 30 de Ag. de 2012
I had the same problem as you when modifying comet3. I got the movie working, but the process eliminates the immeadiate tail of the comet, but leaves the track, so I think it will work for you. I wasn't quite clear on all the k, p and m indexing in comet3, so I reduced it to (removing the "%grow the body" and "%clean up the tail" sections;
function M = comet3(varargin)
...SNIP...
iter = 1;
% Primary loop
m = length(x);
for i = 1:m
set(head,'xdata',x(i),'ydata',y(i),'zdata',z(i))
set(tail,'xdata',x(1:i),'ydata',y(1:i),'zdata',z(1:i))
drawnow
M(iter) = getframe;
iter = iter+1;
end

Más respuestas (0)

Categorías

Más información sobre Animation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by