在MATLAB中绘制向量的轨迹

时间:2014-03-10 09:27:25

标签: matlab vector plot numerical-integration

我在MATLAB中创建了以下数据作为示例,使用x和y轴:

t = 1:5    % time in seconds

dxx = [10,8,6,5,4] % speed in x direction
w = trapz(t,dxx)   % distance object in x direction (numerical integration)

dyy = [9,7,6,5,3]  % speed in y direction
c = trapz(t,dyy)   % distance of object in y direction (numerical integration)

如何仅使用此数据绘制向量dxx(t)与dyy(t)(时间t处的净轨迹)?

1 个答案:

答案 0 :(得分:0)

首先,我假设您需要cumtrapz而不是trapz。 对于绘图,您可以使用quiver

t = 1:5    % time in seconds

dxx = [10,8,6,5,4] % speed in x direction
w = cumtrapz(t,dxx)   % distance object in x direction (numerical integration)

dyy = [9,7,6,5,3]  % speed in y direction
c = cumtrapz(t,dyy)   % distance of object in y direction (numerical integration)

quiver(w,c,dxx,dyy)

导致:

enter image description here

这是你在找什么?