【问题标题】:Plot the trajectory of vectors in MATLAB在 MATLAB 中绘制向量的轨迹
【发布时间】:2014-04-13 07:54:00
【问题描述】:

我在 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 的净轨迹)?

【问题讨论】:

    标签: matlab vector plot numerical-integration


    【解决方案1】:

    首先我假设您需要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)
    

    导致:

    这是你要找的吗?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-09
      • 1970-01-01
      • 1970-01-01
      • 2013-05-10
      • 1970-01-01
      • 1970-01-01
      • 2017-01-18
      相关资源
      最近更新 更多