How to rotate axis by 180 degree?
9 次查看(过去 30 天)
显示 更早的评论
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;
0 个评论
回答(1 个)
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')
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!