5.0 Llamar Rotaciones

2
 clc close all clear all  Px=[4 -8 -12 6 4]; Py=[3 5 -10 -6 3]; Pz=[2 2 2 2 2]; figure(1) hold on plot3(Px,Py,Pz,'r') plot3(0,0,0,'ko') xlabel('X') ylabel('Y') zlabel('Z') axis equal %Rotacion de 48° respecto del eje Z Pxyz=[Px;Py;Pz] Pxyz1=Rotz(48)*Pxyz; Px1=Pxyz1(1,:) Py1=Pxyz1(2,:) Pz1=Pxyz1(3,:) plot3(Px1,Py1,Pz1,'b') view([0 0 1]) pause %Rotacion de -75° respecto del eje Y Pxyz2=Rotz(-75)*Pxyz1; Px2=Pxyz2(1,:) Py2=Pxyz2(2,:) Pz2=Pxyz2(3,:) plot3(Px2,Py2,Pz2,'g') view([0 1 0]) pause %Rotacion de 25° respecto del eje X Pxyz3=Rotz(25)*Pxyz2; Px3=Pxyz3(1,:) Py3=Pxyz3(2,:) Pz3=Pxyz3(3,:) plot3(Px3,Py3,Pz3,'m') view([1 0 0]) pause xlabel('X') ylabel('Y') zlabel('Z') axis equal hold off

Transcript of 5.0 Llamar Rotaciones

Page 1: 5.0 Llamar Rotaciones

7/21/2019 5.0 Llamar Rotaciones

http://slidepdf.com/reader/full/50-llamar-rotaciones 1/1

clcclose allclear all Px=[4 -8 -12 6 4];Py=[3 5 -10 -6 3];Pz=[2 2 2 2 2];figure(1)hold onplot3(Px,Py,Pz,'r')plot3(0,0,0,'ko')xlabel('X')ylabel('Y')zlabel('Z')axis equal%Rotacion de 48° respecto del eje ZPxyz=[Px;Py;Pz]Pxyz1=Rotz(48)*Pxyz;Px1=Pxyz1(1,:)Py1=Pxyz1(2,:)Pz1=Pxyz1(3,:)plot3(Px1,Py1,Pz1,'b')view([0 0 1])pause

%Rotacion de -75° respecto del eje YPxyz2=Rotz(-75)*Pxyz1;Px2=Pxyz2(1,:)Py2=Pxyz2(2,:)Pz2=Pxyz2(3,:)plot3(Px2,Py2,Pz2,'g')view([0 1 0])pause%Rotacion de 25° respecto del eje XPxyz3=Rotz(25)*Pxyz2;Px3=Pxyz3(1,:)Py3=Pxyz3(2,:)Pz3=Pxyz3(3,:)

plot3(Px3,Py3,Pz3,'m')view([1 0 0])pause

xlabel('X')ylabel('Y')zlabel('Z')axis equalhold off