A moving point plot in MATLAB figure with animation.
Mostrar comentarios más antiguos
My program calculates position of a point on Z plane as (X,Y). I need to plot (X,Y) in Z-plane with a moving point showing location of point over the time in a single MATLAB figure. Please help.
Respuesta aceptada
Más respuestas (3)
Image Analyst
el 24 de Jul. de 2013
4 votos
Use the comet() function. It does exactly that.
4 comentarios
Aakash
el 25 de Jul. de 2013
Wei-jiunn Jang
el 30 de Mzo. de 2016
Beautiful solution!
reema shrestha
el 7 de Oct. de 2017
Editada: reema shrestha
el 7 de Oct. de 2017
I exactly want to do the same thing in projectile motion simulation. Instead of using comet to trace the path as well,I want to create a ball and make it follow the trajectory without drawing the trajectory,just the ball moving. Can you suggest me any?
Image Analyst
el 7 de Oct. de 2017
You can perhaps just use plot() with a big dot marker over and over:
for k = 1 : whatever
x = ......
y = ......
plot(x, y, 'r.', 'MarkerSize', 30);
end
Mohamadreza Khashei
el 3 de Nov. de 2021
0 votos
for k = 1 : whatever x = ...... y = ...... plot(x, y, 'r.', 'MarkerSize', 30); end
Muhammad Hadyan Utoro
el 29 de Sept. de 2022
Movida: Image Analyst
el 29 de Sept. de 2022
0 votos
x = [0:0.01:2*pi];
for i = 1:length(x)
y = sin(x);
figure(1)
plot(x,y,'-o','MarkerIndices',1+i)
hold off
pause(0.005)
end
Categorías
Más información sobre Animation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!