MATLAB Answers


I want to draw an arrow in vector.

Asked by Muhendisleksi on 9 Oct 2017
Latest activity Commented on by Star Strider
on 12 Dec 2017
Q = [0,977 -0,016
-0,016 0,176];
p1 = [0.977 -0.016]; %Coordinate of the first point
p2 =[-0.016 0.176]; % Coordinate of the second point
The start and end points of the arrow are as above. How can I draw a vector arrow with these points?


Sign in to comment.


3 Answers

Answer by Jan
on 9 Oct 2017


I checked all of them. But I could not find what I wanted.
on 9 Oct 2017
If you explain exactly, what you want, it is possible for the readers to give any specific suggestions. The information, that the dozens of existing implementations do not satisfy your needs, does not allow for further help.

Sign in to comment.

Answer by Star Strider
on 9 Oct 2017
Edited by Star Strider
on 9 Oct 2017

One option is the quiver plot:
Q = [0.977 -0.016
-0.016 0.176];
QX = Q(:,1); % Isolate Line ‘x’ Coordinates
QY = Q(:,2); % Isolate Line ‘y’ Coordinates
[~,UV] = gradient(Q); % Generate Gradient
UVX = [UV(1,1); 0]; % Define Quiver Arrow ‘x’
UVY = [UV(1,2); 0]; % Define Quiver Arrow ‘y’
% plot(QX, QY, '-r', 'LineWidth',1.2) % Plot Line (Optional)
hold on
quiver(QX, QY, UVX, UVY, 0)
hold off
axis([-0.15 1.1 -0.15 0.2])
axis equal
EDIT Added axis calls to the plot.


Sign in to comment.

Answer by Martin Meiringer on 12 Dec 2017

Is there a reason why this functionality is still not built in? Using file exchange functions is always a bit difficult if you are sharing your work with colleagues. so please, Mathworks do a arrow / arrow3 function!!!

  1 Comment

Submit an Enhandement Request at Contact Us (link).

Sign in to comment.