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

조회 수: 4 (최근 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 CenterFile Exchange에서 Simulation에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by