2012-09-16 105 views
1
箭頭

我想用繪製箭頭功能MATLAB奇異向量,但MATLAB不斷給我的錯誤:如何繪製在MATLAB

Undefined function 'arrow' for input arguments of type 'double'

我該如何解決這個問題?

這裏是MATLAB代碼:

function Plot_Singular_Vecor() 
A=[1 1;2 3]; 

[U,S,V] = svd(A); % Find singular value decomposition. 

figure; 
theta = -pi:pi/50:pi; 
circle = [cos(theta); sin(theta)]; 
plot(circle(1,:), circle(2,:), 'r'), grid 
title('Right Singular Vectors, u1 and u2') 
hold on; 
arrow([0,0], [V(1,1), V(2,1)]) 

回答

3

你需要從MATLAB文件交換安裝arrow功能,或者如果你具備的功能,確保它在你的PATH。

+0

非常感謝! – Ming

+2

@Hello_World一定要接受這個答案,如果它解決了你的問題。 – slayton

2

或者您可以使用內置的功能顫動

quiver(0,0,V(1,1),V(2,1)) 

或批註功能

annotation('arrow',[0,0],[V(1,1),V(2,1)]) 
+0

說明:'顫抖(X,Y,Vx,Vy)'將從(X,Y)'中畫出一個箭頭到'(X + a * Vx,Y + a * Vy)計算因子。 –