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 日

0 投票

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 日
Yes this is great! How would I save this as maybe a video to show in a presentation?
Star Strider
Star Strider 2021 年 7 月 8 日
Thank you!
See the documentation for movie. It describes all the necessary steps, and links to other necessary functions.
.
Kelly McGuire
Kelly McGuire 2021 年 7 月 8 日
Great thanks!
Star Strider
Star Strider 2021 年 7 月 8 日
As always, my pleasure!
.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeAnimation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by