在MATLAB中绘制矢量轨迹
我使用x轴和y轴在MATLAB中创建了以下数据作为示例:在MATLAB中绘制矢量轨迹,matlab,vector,plot,numerical-integration,Matlab,Vector,Plot,Numerical Integration,我使用x轴和y轴在MATLAB中创建了以下数据作为示例: 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
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)vs dyy(t)(时间t的净轨迹)?首先,我假设您需要的是而不是trapz
。
用于打印,可以使用
导致:
这就是你要找的吗
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)