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

3 views (last 30 days)
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

Answers (1)

KSSV
KSSV on 6 Jan 2022

Categories

Find more on Simulation in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!