Capture frames from 3D comet plot to make a movie

조회 수: 10 (최근 30일)
Ram
Ram 2012년 8월 29일
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

채택된 답변

Kevin Claytor
Kevin Claytor 2012년 8월 30일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by