Reputation: 497
I am trying to plot a singular vector in MATLAB using arrow function, but MATLAB keeps giving me the error:
Undefined function 'arrow' for input arguments of type 'double'
How do I fix this?
Here is the MATLAB code:
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)])
Upvotes: 1
Views: 12550
Reputation: 2956
Alternatively you can use the built-in function quiver
quiver(0,0,V(1,1),V(2,1))
or the annotation function
annotation('arrow',[0,0],[V(1,1),V(2,1)])
Upvotes: 2