As a continuation to one of my previous posts, on multi-line comet plots, this submission extends comet3 to give the user ability to control the length of the tail, the speed of the animation, and the style of the head and tail of the comet. comet and comet3 are useful functions, because these are functions that take similar type of input as other plotting functions and have animation built into them. I have used both of these functions in the past, but as computers became faster, the animation became too fast to view. That's why I really like the ability of PlotComet_3D to control the speed.
Here's what comet3 looks like.
t = -pi:pi/300:pi; x = sin(5*t); y = cos(3*t); z = t;
comet3(x, y, z)
By using Nick's PlotComet_3D, you can specify the speed in frequency, allowing for a consistent animation regardless of processing speed. Here, I'm also specifying a particular marker for the head of the comet.
% Define marker style for the head of the comet Head = struct(... 'Marker', 'p', ... 'MarkerSize', 10, ... 'MarkerEdgeColor', 'b', ... 'MarkerFaceColor', 'b');
% Animate at 100 Hz, tail length of 30 PlotComet_3D(x, y, z, ... 'Frequency', 100, ... 'blockSize', 30, ... 'headFormat', Head);
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.