2012-09-16 107 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)计算因子。 –