Make a point move straight up and down
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I would like to know how to plot a point and just make it go up, down, and back to the starting point. I was thinking about making a list of y values but was not sure if there was a simpler way.
Thanks
0 commentaires
Réponses (2)
Sulaymon Eshkabilov
le 15 Août 2020
Hi,
A simple motion or animation tool with plot tools is drawnow that can be employed in your task, e.g.:
2 commentaires
Sulaymon Eshkabilov
le 15 Août 2020
Hi,
If I've understood your question correctly, you'd like to get a up and down motion of a point x, y(i). Then here is one of the possible animated plots with drawnow:
for ii=1:numel(x) %loop
plot(x,y, '--', px, y(ii),'o', 'markerfacecolor', 'y'); %circle point
hold off
drawnow
end
Voir également
Catégories
En savoir plus sur Graphics Performance dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!