im trying to make a code to show the movements of particles on a graph. whenever the graph is plotted the particles dont move. How do I make the plots move over time?

3 commentaires

KSSV
KSSV le 3 Mai 2018
I already made comments on your last question......your code need to be reconsidered......by the way your loop has only one step.
Stephen23
Stephen23 le 15 Nov 2019
Original Question by Joseph Stocken "Trying to make an animation of particle movement":
im trying to make a code to show the movements of particles on a graph. whenever the graph is plotted the particles dont move. How do I make the plots move over time?
Képkivágás.PNG
Rena Berman
Rena Berman le 12 Déc 2019
(Answers Dev) Restored edit

Connectez-vous pour commenter.

 Réponse acceptée

Walter Roberson
Walter Roberson le 3 Mai 2018

0 votes

You need to add a drawnow() or pause() after the scatter.
It is recommended that instead of using scatter() inside the loop, that instead you scatter() once before the loop and record the handle that is returned. Then inside the loop, set() the XData and YData properties of the handle to reflect the new locations: that is more efficient than rebuilding the axes each time the way you are now.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by