matlab - quiver3 返回长度不正确的向量

标签 matlab matlab-figure

我有一组向量

t = [ -1    -1     0
       1    -1     0
       1     1     0
      -1     1     0 ]

这些向量在按顺序绘制时(从头到尾)形成一个正方形

我使用 quiver3 指令来获取这些向量的绘图,如下所示:

quiver3(starts(:,1), starts(:,2), starts(:,3), t(:,1), t(:,2), t(:,3))

我通过矩阵 t 的累积和计算“starts”并得到以下结果

starts = [ 0     0     0
          -1    -1     0
           0    -2     0
           1    -1     0]

所有值都非常有意义,如果手动绘制,则会给出一个正方形,但 quiver3 返回以下图

enter image description here enter image description here

为什么矢量的头没有碰到尾部?我该如何解决这个问题?

最佳答案

您需要将AutoScaleFactor设置为1:

t = [...
    -1    -1     0
     1    -1     0
     1     1     0
    -1     1     0]

starts = [...
     0     0     0
    -1    -1     0
     0    -2     0
     1    -1     0]

quiver3(starts(:,1), starts(:,2), starts(:,3), t(:,1), t(:,2), t(:,3), ...
        'AutoScaleFactor',1)

enter image description here

默认设置为0.9,否则整个矢量场看起来会有点困惑。


编辑:看看这对您有何作用:

 starts = [ 0 0 0; -13 12 0]
 t = [ -13 12 0; -1 2 0]

 quiver3(starts(:,1), starts(:,2), starts(:,3), t(:,1), t(:,2), t(:,3), 0)
 view(0,90)

0定义固定比例因子,0表示不缩放。 enter image description here

关于matlab - quiver3 返回长度不正确的向量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29780285/

相关文章:

function - 为什么我没有通过任何错误时会收到 "Too many input arguments"错误?

matlab - 修改x轴位置

Matlab R2016a 错误 - 等待用户输入时无法与图形交互

matlab - 3 matlab图中的x轴?

matlab - 在Matlab中生成时间戳系列?

algorithm - 如何使这个算法稳定

matlab - 如何将变量传递给通过指南创建的函数

c++ - 5维数组哈希表

matlab - 在子图的情况下,如何为所有 x 轴和 y 轴使用通用标签?

MATLAB:如何正确应用 ifft 将 "filtered"信号带回时间域?