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

3 vues (au cours des 30 derniers jours)
Devin Dalton
Devin Dalton le 5 Jan 2022
Réponse apportée : KSSV le 6 Jan 2022
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

Réponses (1)

KSSV
KSSV le 6 Jan 2022

Catégories

En savoir plus sur Simulation dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by