Make a point move straight up and down
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Sulaymon Eshkabilov
el 15 de Ag. de 2020
Hi,
A simple motion or animation tool with plot tools is drawnow that can be employed in your task, e.g.:
2 comentarios
Sulaymon Eshkabilov
el 15 de Ag. de 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
Ver también
Categorías
Más información sobre Animation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!