我有一组向量
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
返回以下图
为什么矢量的头没有碰到尾部?我该如何解决这个问题?
最佳答案
您需要将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)
默认设置为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表示不缩放。
关于matlab - quiver3 返回长度不正确的向量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29780285/