MATLAB: Rotate 3D quiver

3d plotsquiver

I am trying to plot 3D vectors of the scene using quiver 3 function, The output upsidedown!
I reverse all the axis X,Y and Z … I try to reverse each one separately
I could not get what I really want .. I want it as we see it in the reality
as you see in the image … the wall and floor not adjust correctly!
How can I make them in the correct position?
I am including the function that I am used to getting this plot
%---------------------3D VECTOR FLOW -------------------------%
function Display_3D_flow(Z,U,V,W,sample,scale,title_stg,...
filename,ymin,ymax,zmin,zmax,xmin,xmax)
pic_x=size(Z,1);
pic_y=size(Z,2);
U=U*scale;
V=V*scale;
W=W*scale;
rx=pic_x:-sample:1;
%rx=1:sample:pic_x;
ry=1:sample:pic_y;
littleU=U(rx,ry);
littleV=V(rx,ry);
littleW=W(rx,ry);
NO_AUTOMATIC_SCALING=0;
[littleX,littleY] = meshgrid(ry,rx);
littleZ=Z(rx,ry);
figure
quiver3(littleX,littleY,littleZ,littleU,littleV,littleW,NO_AUTOMATIC_SCALING);
%view([90,90,-180])
axis([xmin xmax ymin ymax zmin zmax])
title(title_stg)
xlabel('X-axis')
ylabel('Y-axis')
zlabel('Z-axis')
hold on
%set(gca,'YDir','Reverse')
set(gca,'ZDir','Reverse')
%set(gca,'XDir','Reverse')
hold off
jpg_filename=[filename,'.jpg'];
print('-djpeg',jpg_filename)
end

Best Answer

  • For any one face this in the future, I change the order of the variable in the quiver to become like this
    instead of using X Y Z order now I am using X Z Y
    quiver3(littleX,littleZ,littleY,littleU,littleW,littleV,NO_AUTOMATIC_SCALING);
    axis([xmin xmax zmin zmax ymin ymax])
    This change the scene to looks better
  • Related Question