How to rotate quiver head in 3d in matlab

21 ビュー (過去 30 日間)
Mathias Singsaas Frøseth
Mathias Singsaas Frøseth 2017 年 4 月 25 日
編集済み: Adam Danz 2021 年 8 月 14 日
I'm plotting a velocity profile in 3d:
To make the arrows in the velocity profile I use "quiver3", the problem is that I want to rotate the arrowhead to be vertical, and not horizontal like they are now. Is this possible to do?
I tried a solution from another thread that sugested to use: g = hgtransform; quiver(x,y,u,v,'Parent',g) set(g,'Matrix',makehgtform('zrotate',pi/4))
But I did not get this to work.
I used: p2 = plot3((15*data_VP5_U)+13,y, Z,'b-','LineWidth',1.5) p3 = plot3(x,(10*data_VP5_V)+20, Z,'k-','LineWidth',1.5)
to plot the lines, and:
f1 = quiver3(13,y(1),Z(450), (16*data_VP5_U(450)),0,0,'b-','MaxHeadSize',0.8)
to plot the quiver.

回答 (1 件)

Prashant Arora
Prashant Arora 2017 年 4 月 27 日
Hi Mathias,
One way to possibly do it is by rotating the quiver arrows.
h = quiver3(0,0,0,0.5,0,0,'b-','MaxHeadSize',0.8)
% Find HGTransform
t = hgtransform('Parent',gca);
% Make a Transform to rotate 90 degrees on x Axis
R = makehgtform('xrotate',pi/2);
% Set the Transformation Matrix
set(t,'Matrix',R);
% Set the Parent of Quiver to the new Transform
set(h,'Parent',t); % The arrows should point correctly now
You will probably need to extrapolate this approach by finding the right hgtransform at the right location.
  2 件のコメント
Mathias Singsaas Frøseth
Mathias Singsaas Frøseth 2017 年 5 月 1 日
Can you elaborate what you mean by"extrapolate this approach by finding the right hgtransform at the right location."?
Yunchao Yang
Yunchao Yang 2017 年 5 月 29 日
It means that the default rotating location is the center of the axes, and you may change the rotating center as you need.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeVector Fields についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by