3D传染媒介剧情错了

时间:2013-03-06 13:45:49

标签: vector 3d octave

我根据帖子在Octave中编写了一个脚本: How to draw vectors (physical 2D/3D vectors) in MATLAB?

我在Octave中有以下代码,我收到错误 '“vector”在第3行第1列

附近未定义

任何人都可以帮助我吗?我已经为Octave编写了一些其他的* .m文件没有问题,现在我被卡住了。

a = [0 0 1];   %# Vector 1  
b = [0.894 0 0.447];   %# Vector 2
c = [0.276 0.851 0.447];   %# Vector 3
d = [-0.724 0.526 0.447];   %# Vector 4
e = [-0.724 -0.526 0.447];   %# Vector 5
f = [0.276 -0.851 0.447];   %# Vector 6 
g = [0.724 0.526 -0.447];   %# Vector 7 
h = [-0.276 0.851 -0.447];   %# Vector 8    
i = [-0.894 0 -0.447];   %# Vector 9    
j = [-0.276 -0.851 -0.447]   %# Vector 10   
k = [0.724 -0.526 -0.447];   %# Vector 11   
l = [0 0 -1];   %# Vector 12

starts = zeros(3,3);
ends = [a;b;c;d;e;f;g;h;i;j;k;l];

quiver3(starts(:,1), starts(:,2), starts(:,3), starts(:,4), starts(:,5),
        starts(:,6), starts(:,7), starts(:,8), starts(:,9), starts(:,10),
        starts(:,11), starts(:,12), ends(:,1), ends(:,2), ends(:,3),
        ends(:,4), ends(:,5), ends(:,6), ends(:,7), ends(:,8), ends(:,9),
        ends(:,10), ends(:,11), ends(:,12), 0)

axis equal

1 个答案:

答案 0 :(得分:0)

这不起作用,因为starts的大小为3x3,并且您在列索引上将其索引为12。我得到的错误信息是:

error: A(I,J): column index out of bounds; value 4 out of bound 3