フィルターのクリア

How to rotate axis by 180 degree?

10 ビュー (過去 30 日間)
CL
CL 2022 年 9 月 21 日
コメント済み: CL 2022 年 9 月 21 日
By default, Matlab plots the my three unit vectors (x,y,z) in a way that the z-axis points up. How can I "roll" the orientation around the x-axis by 180 degrees so I can have the z-axis unit vector points down positively?
The right-hand rule has to be preserved - I'm not flipping any of the axis.
x=[1;0;0];
y=[0;1;0];
z=[0;0;1];
quiver3(0,0,0,x(1),x(2),x(3),'Color','green','LineWidth',2,'MaxHeadSize',0.5);
hold on;
quiver3(0,0,0,y(1),y(2),y(3),'Color','blue','LineWidth',2,'MaxHeadSize',0.5);
hold on;
quiver3(0,0,0,z(1),z(2),z(3),'Color','red','LineWidth',2,'MaxHeadSize',0.5);
axlims = norm(x)*1.2;
set(gca,'xlim',[-1,1]*axlims,'ylim',[-1,1]*axlims,'zlim',[-1,1]*axlims);
grid on;
axis square;

回答 (1 件)

Chunru
Chunru 2022 年 9 月 21 日
x=[1;0;0];
y=[0;1;0];
z=[0;0;1];
quiver3(0,0,0,x(1),x(2),x(3),'Color','green','LineWidth',2,'MaxHeadSize',0.5);
hold on;
quiver3(0,0,0,y(1),y(2),y(3),'Color','blue','LineWidth',2,'MaxHeadSize',0.5);
hold on;
quiver3(0,0,0,z(1),z(2),z(3),'Color','red','LineWidth',2,'MaxHeadSize',0.5);
axlims = norm(x)*1.2;
set(gca,'xlim',[-1,1]*axlims,'ylim',[-1,1]*axlims,'zlim',[-1,1]*axlims);
grid on;
axis square;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(gca, 'ZDir', 'reverse')
  2 件のコメント
CL
CL 2022 年 9 月 21 日
Ah no - as shown in both images in the question, both orientations has to obey the right-hand-rule. Reversing the orientation would break the the right-hand orientation and direction of rotation. I should have specified it better.
CL
CL 2022 年 9 月 21 日
ok ... I guess I'll just reverse the Y axis as well then to return to the right-hand orientation. thanks

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

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by