I want to draw an arrow in vector.
137 visualizzazioni (ultimi 30 giorni)
Q = [0,977 -0,016
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?
Matevz Lavtar il 14 Nov 2020
I have the same problem, so I make a function that solve this problem I think.
Here is a link to it: https://www.mathworks.com/matlabcentral/fileexchange/82665-plotting-vectors-with-arrow-head-pvec?s_tid=prof_contriblnk
Example what can you do with it:
Hope it helps you
Jan il 9 Ott 2017
Star Strider il 9 Ott 2017
Modificato: Star Strider il 9 Ott 2017
One option is the quiver plot:
Q = [0.977 -0.016
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)
quiver(QX, QY, UVX, UVY, 0)
axis([-0.15 1.1 -0.15 0.2])
EDIT — Added axis calls to the plot.
Martin Meiringer il 12 Dic 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!!!