简体   繁体   中英

plotting trajectory data in matlab

I have trajectory information in 3 dimensions in matlab. These are of a gesture someone is making. When I connect the points in matlab by using plot3, I can see the trajectory nicely. However, the trajectory is a line in the plot, but I don't know in which direction the gesture has been made as the time is not visualized. Is it possible to visualize this in a 3d plot (where the dimensions are x, y and z)? For example, the colour at the start is bright red and the colour at the end is black.

Thanks for your help,

Héctor

You need the comet3 plot (if you don't mind animations).

If you do mind animations, and you're looking for a static figure, I'd use a quiver .

Example:

% value of the parameter in the parametric equation
t = 0:0.5:2*pi;

% modified coordinate axes
u = [1 0 0].';
v = [0 2 0].';

% coordinates of the ellipse
Ell  = bsxfun(@plus, bsxfun(@times, u, cos(t)), bsxfun(@times, v, sin(t)));

% difference vectors between all data points will be used as "velocities"
dEll = diff(Ell, 1,2);

% Quiver the ellipse
quiver3(...
    Ell(1,1:end-1), Ell(2,1:end-1), Ell(3,1:end-1), ...
    dEll(1,:), dEll(2,:), dEll(3,:), ...
    2,  'r')  % = scale, LineSpec

axis tight equal

Result:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM