Cannot set quiver head size bigger than 1/3 of the length of the arrow.
78 ビュー (過去 30 日間)
古いコメントを表示
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/212808/untitled.png)
0 件のコメント
回答 (1 件)
A. Sawas
2019 年 4 月 9 日
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
参考
カテゴリ
Help Center および File Exchange で Vector Fields についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!