How can I rotate a point in 3D?

6 views (last 30 days)
Alexandra Stan
Alexandra Stan on 28 Apr 2015
Commented: Star Strider on 28 Apr 2015
Hello,
I have a point which I want to rotate using this 2 angles: alpha=-9,3(degrees) and beta=-0,5(degrees). I have to do this in Matlab 3D. I've tried to use "rotate" but it didn't worked. If someone can help, let me know.
the point is indicated by the arrow
this is the my code:
figure
x1=[0 52.7 106.3 158.8 1.97 54.87 108.87 162.07];
y1=[0 0 0 0 12.14 12.14 12.14 12.14];
z1=[0 0 0 0 0 0 0 0];
x2=[-18.1 -18.1 -20 -20 176.4 176.4 180 180];
y2=[-4.5 51 -4.5 51 -5.1 51.2 -5.1 49.2];
z2=[27.83 27.83 42.33 42.33 25.8 25.8 40.1 40.1];
plot3(x1,y1,z1,'ro','markersize',9.140,'markerfacecolor','r');
hold on
plot3(x2,y2,z2,'bo','markersize',9.140,'markerfacecolor','b');
grid
xlim([-40 200]);
ylim([-40 80]);
zlim([-20 60]);
xlabel('x');
ylabel('y');
zlabel('z');
legend('Barrette','Barriere')
Thank you

Answers (1)

Star Strider
Star Strider on 28 Apr 2015
I don’t understand what you want to do, but the cart2sph function will probably let you do it.
  2 Comments
Alexandra Stan
Alexandra Stan on 28 Apr 2015
Ok. I will try the cart2shp function. Thank you
Star Strider
Star Strider on 28 Apr 2015
After you map the point to spherical coordinates and rotate it, then use the sph2cart function to map it back so you can plot it with the rest of your data.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!