2013-03-06 42 views
0

我已經寫在八度腳本低於基於掀起了崗位: How to draw vectors (physical 2D/3D vectors) in MATLAB?三維向量圖出了錯

我在八度以下的代碼,我得到的錯誤 '‘矢量’未定義線附近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 

回答

0

這不起作用,因爲starts是大小3×3的,你是它的索引最多12列索引。我得到的錯誤信息是:

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