Create and Save a time varying animation of x-y position

3 ビュー (過去 30 日間)
Devin Dalton
Devin Dalton 2022 年 1 月 5 日
回答済み: KSSV 2022 年 1 月 6 日
I have a time varrying integration simulation that outputs a Time vector "T" where T(1) = 0 and T(end) = simulation run time but the steps between T(i) and T(i+1) is not constant, it also outputs a position vector Q where Q(1,1) = my initial x position and Q(2,1) is my initial y position. Q(1,end) is the x-position at the end of the simulation and Q(2,end) is the y-position at the end of the simulation.
I want to create and save (to use in a presentation) an animation of the x-y position that varries with time giving you a sense of the velocity as well.
Right now the code I am using below has two issues:
1: I can't save the animation
2: The animation doesn't incorporate the variance in time giving the animation a constant velocity feel when in actuality my velocity is increasing.
plot(Q(1,:),Q(2,:))
hold on
for i = 1:length(Q(1,:))
h = plot(Q(1,i),Q(2,i),'^r');
pause(0.0001)
delete(h)
end

回答 (1 件)

KSSV
KSSV 2022 年 1 月 6 日

カテゴリ

Help Center および File ExchangeSimulation についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by