필터 지우기
필터 지우기

Animate 2D coordinate plot

조회 수: 5 (최근 30일)
Kelly McGuire
Kelly McGuire 2021년 7월 8일
댓글: Star Strider 2021년 7월 8일
I have a list of x,y coordinates for a particle. I would like to animate the plot so it looks like the particle is drawing out its path. I have attached what the final plot looks like in excel. Can someone help me turn this into an animated Matlab figure? Thanks!

채택된 답변

Star Strider
Star Strider 2021년 7월 8일
Try this —
D1 = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/678468/Clcoords.xls');
figure
hold on
for k = 1:size(D1,1)-1
plot(D1(k:k+1,1), D1(k:k+1,2), '.-b')
axis([-150 150 -150 150])
pause(0.01)
drawnow
end
hold off
.
  댓글 수: 4
Kelly McGuire
Kelly McGuire 2021년 7월 8일
Great thanks!
Star Strider
Star Strider 2021년 7월 8일
As always, my pleasure!
.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by