Dynamic graph of polygonial lines

Hi, I am trying to solve this issue for couple of weeks. I want to have a single 2d figure on which I will draw not-closed 3 polygonial lines of different colors.
So pseudocode should be something like this:
draw(path1,path2,path3);
for i=1:10
path1=f1();
path2=f2();
path3=f3();
draw(path1, path2, path3);
User should just watch it, without need to click anything.
Can you give me some hint, please.
Thank you

 Réponse acceptée

Grzegorz Knor
Grzegorz Knor le 7 Sep 2011
doc pause
doc drawnow
Example:
hold all
h1 = plot(rand(100,1));
h2 = plot(rand(100,1));
h3 = plot(rand(100,1));
drawnow
hold off
for k=1:10
set(h1,'ydata',rand(100,1))
set(h2,'ydata',rand(100,1))
set(h3,'ydata',rand(100,1))
pause(0.5)
end

2 commentaires

Ted Munisted
Ted Munisted le 7 Sep 2011
Thank you very much!
Is it possible to same-color lines be not-connected? Like in this picture: http://i51.tinypic.com/2wns3v8.png
Grzegorz Knor
Grzegorz Knor le 8 Sep 2011
Color of each line you can set as follows:
h = plot(rand(100,1),'Color',[1 0 0]);
for k=1:10
set(h,'Color',[k/10 1-k/10 0.5+k/20])
pause(0.5)
end

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by