A moving point plot in MATLAB figure with animation.
이전 댓글 표시
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.
채택된 답변
추가 답변 (3개)
Image Analyst
2013년 7월 24일
4 개 추천
Use the comet() function. It does exactly that.
댓글 수: 4
Aakash
2013년 7월 25일
Wei-jiunn Jang
2016년 3월 30일
Beautiful solution!
reema shrestha
2017년 10월 7일
편집: reema shrestha
2017년 10월 7일
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
2017년 10월 7일
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
2021년 11월 3일
0 개 추천
for k = 1 : whatever x = ...... y = ...... plot(x, y, 'r.', 'MarkerSize', 30); end
Muhammad Hadyan Utoro
2022년 9월 29일
이동: Image Analyst
2022년 9월 29일
0 개 추천
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
카테고리
도움말 센터 및 File Exchange에서 Animation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!