Cannot set quiver head size bigger than 1/3 of the length of the arrow.

104 views (last 30 days)
Hi,
I would like to control the arrow head for my quiver arrow plots. It does not seem like I can not set quiver head size bigger than 1/3 of the length of the arrow. Does anyone know how to do that or know a workaround? I have included an example where you can see I can set the size of the arrow head up until 1/3 of the length of the arrow, but not bigger then that.
figure
myquiver([0,0], [1,0], 0.1,'-',2);hold on;
myquiver([0,0.5],[1,0], 0.2,'-',2)
myquiver([0,1], [1,0], 0.3,'-',2)
myquiver([0,1.5],[1,0], 0.3333,'-',2)
myquiver([0,2], [1,0], 0.4,'-',2)
myquiver([0,2.5],[1,0], 0.5,'-',2)
myquiver([0,3], [1,0], 0.6,'-',2)
axis equal
function qh = myquiver(X,V,headSize,linStyle,linewidth)
qh = quiver(X(1),X(2),...
V(1),V(2),...
0,... % automatically scales the arrows to fit within the grid and then stretches them by the factor scale. scale = 2 doubles their relative length, and scale = 0.5 halves the length. Use scale = 0 to plot the velocity vectors without automatic scaling
'AutoScale','off',...
'MaxHeadSize',headSize*(3)/norm(V),... headSize is the head size,but it cannot be longer than 1/3 of the vector length (for some reason)
'LineWidth',linewidth,...
'LineStyle',linStyle);
untitled.png

Answers (1)

A. Sawas
A. Sawas on 9 Apr 2019
There is a cutoff on how big the head size is compared to the norm of the arrow. If you can allow the norm to get longer you will be able to increase the head size.
Also, MaxHeadSize is a scalar value in units relative to the length of the arrow. So, the effective value is less than 1.
myquiver([0,2.5],[1,0], 0.5,'-',2); % head size is 0.5 of the norm=1
myquiver([0,3], [2,0], 0.6,'-',2); % head size is 0.6 of the norm=2
  1 Comment
Brian
Brian on 10 Apr 2019
Hi A. Sawas,
Thanks for your reply.
Yes, my problem is exactly that I would like to make the arrow heads longer/bigger than 1/3 of the norm of the vector. I am trying to remove this cutoff or change it to a bigger value.
From what I found out MaxHeadSize*3 is the length of the arrow head relative to the norm of the vector. You can see how this is used in myquiver()

Sign in to comment.

Categories

Find more on Vector Fields in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!