Trajectory animation using coordinate points
88 views (last 30 days)
I have set of x, y and z coordinates of two objects and I want to create animation of the object's 3D trajectory/motion using these coordinates. Consider the first coordinate in the set as the initial position. Can anyone help me with this.
darova on 1 Sep 2019
Animation it is just changing of images like in cartoons
for i = 1:length(x)
h = plot(x(i),y(i),z(i),'^r'); % draw something on the trajectory
pause(0.2) % wait a minute
delete(h) % delete it
More Answers (1)
David K. on 30 Aug 2019
Edited: David K. on 3 Sep 2019
I would do it like this:
% x1,x2,y1,y2,z1,z2 are your coordinate vectors
tstep = .1; % the amount of time between each value in the vectors
for n = 1:length(x1)
title((n-1)*tstep); % label the time of each step
If the default view of the plot is bad mess around with the view function to try and get a better one.
This will make an animation with both, to make the other two animations simply repeat it and leave out the xyz coordinates of the one you do not want to look at.
edit: fixed so it should actually work now