MATLAB Answers

Union Colleg

I made a 2D color plot, how do I turn the plot into an animation or video of the points being put into place? Thanks

Asked by Union Colleg
on 17 Jul 2013

The plots differ in color based on the Z value.




No products are associated with this question.

4 Answers

Answer by Image Analyst
on 17 Jul 2013


Answer by Youssef Khmou
on 17 Jul 2013


If you mean you have a plot from 2 vectors x and y, then you can use the function pause to drawn each point :

 for n=1:length(x)
        pause(N),    % where N is numbers of seconds
        hold on,

Here is an example from my File Exchange :


Answer by Union Colleg
on 17 Jul 2013

Thank you very much these have both been very helpful as I am just starting up in the matlab world.


Answer by Shane
on 18 Jul 2013
Edited by Shane
on 18 Jul 2013

The comet function is also quite nice.

    X = sin(0:.01:2*pi);
  X = sin(0:.01:2*pi);
  Y = 0:.01:2*pi;

  1 Comment

Image Analyst
on 18 Jul 2013

Yes, though it could be even better if there were some way to control the speed of the comet and length of the tail.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!