- Exercise/Example 3
Figure 2.5. Point P on slab
Tema: Successive rotation about global axes.
The final position of the corner P (5, 30, 10) of the slab shown in Figure 2.5 after 30deg rotation about the Z-axis, followed by 30deg about the X-axis, and then 90deg about the Y-axis can be found by first multiplying QZ, 30 by [5, 30, 10]T to get the new global position after first rotation
% Skrip MATLAB 2011b
% diketahui
% definisi variabel untuk sudut P dari slab/papan
p1 = 5;
p2 = 30;
p3 = 10;
% matrik P =
P = [p1;p2;p3];
%——————————–
% Z_axis = 30 derajat pada sumbu z
% X_axis = 30 derajat pada sumbu x
% Y_axis = 90 derajat pada sumbu y
Z_axis = pi/6; %30 derajat pada sumbu z
X_axis = pi/6; %30 derajat pada sumbu x
Y_axis = pi/2; %90 derajat pada sumbu y
% pertanyaan: Posisi P setelah rotasi pada
% sumbu z=30 derajat, dilanjutkan sumbu x=30 derajat, dan
% sumbu y=90 derajat.
%—Penyelesaian————————————–
% Maka global position setelah rotasi pertama sumbu z
% |X2| |cos(Z_axis) -sin(Z_axis) 0|
% |Y2| =|sin(Z_axis) cos(Z_axis) 0| * [P] = ?
% |Z2| |0 0 1|
%Pembentukan matrik Pz
Pz = [cos(Z_axis) -sin(Z_axis) 0;
sin(Z_axis) cos(Z_axis) 0;
0 0 1];
Qz_30 = Pz * P;
%———————————————
% kemudian dirotasi pada sumbu x=30 derajat
% Maka global position setelah rotasi kedua sumbu x
% |X3| |1 0 0 |
% |Y3| =|0 cos(X_axis) -sin(X_axis)| * [Qz_30]= ?
% |Z3| |0 sin(X_axis) cos(X_axis)|
%Pembentukan matrik Px
Px = [1 0 0;
0 cos(X_axis) -sin(X_axis);
0 sin(X_axis) cos(X_axis)];
Qx_30 = Px * Qz_30;
%———————————————
% kemudian dirotasi pada sumbu y=90 derajat
% Maka global position setelah rotasi kedua sumbu x
% |X4| |cos(Y_axis) 0 sin(Y_axis)|
% |Y4| =| 0 1 0 | * [Qx_30] = ?
% |Z4| |-sin(Y_axis) 0 cos(Y_axis)|
%Pembentukan matrik Py
Py = [cos(Y_axis) 0 sin(Y_axis);
0 1 0;
-sin(Y_axis) 0 cos(Y_axis)];
Qy_90 = Py * Qx_30;
%———–selesai——————–
Hasil:
Posisi titip P setelah dirotasi pada sumbu z sebesar 30’ adalah:
Kemudian posisi titip P setelah dirotasi pada sumbu x sebesar 30’ adalah:
Kemudian posisi titip P setelah dirotasi pada sumbu y sebesar 90’ adalah:
- Exercise/example 198
Rotation of a body point about a global axis. The slab shown in Figure 2.5 is turning about the Z-axis with 10 deg /s. The global velocity of the corner point P(5, 30, 10), when the slab is at = 30 deg, is:
% Skrip MATLAB 2011b
% definisi variabel untuk konstanta GRB
a1=sin(pi/6); a2=-cos(pi/6); a3=0;
a4=cos(pi/6); a5=-sin(pi/6); a6=0;
a7=0; a8=0; a9=0;
%matrik GRB nya
GRB = [a4 a5 a3;
a1 a4 a6;
a7 a8 a9];
GRBt = [a5 a2 a3;
a4 a5 a6;
a7 a8 a9];
%definisi variabel untuk BrP
b1=5;
b2=30;
b3=10;
BrP = [b1;b2;b3];
%nilai sudut putaran = alpha
a=10;
alpha=(a*pi)/180;
% global velocity of the corner point
GvP = alpha * GRBt *BrP;
% global positionnya
GrP = GRB * BrP;
%———–selesai——————————
Hasil:
à global velocity of the corner P point
à global position
% Example 72 Moving body coordinate frame.
% Figure 4.2 shows a point P at BrP = 0.1i + 0.3j + 0.3k in a body frame B, which is rotated 50deg about the Z-axis, and translated 1 along X, 0.5 along Y, and 0.2 along the Z axes.
% The position of P in global coordinate frame is:
% Gr = (GRB * BrP) + Gd
%Pengujian Example 72
%definisi variabel untuk konstanta GRB
i = 0.1;
j = 0.3;
k = 0.3;
%BrP = poin P pada body frame
BrP = [i;j;k];
%——————————–
az = 50; %50 derajat pada sumbu z
a1=cos(az); a2=-sin(az); a3=0;
a4=sin(az); a5=cos(az); a6=0;
a7=0; a8=0; a9=1;
%matrik GRB nya
GRB = [a1 a2 a3;
a4 a5 a6;
a7 a8 a9];
%——————————–
tx = -1;
ty = 0.5;
tz = 0.2;
%matrik Gd = nilai translasi (translation value)
Gd = [tx;ty;tz];
% The position of P in global coordinate frame is
Gr1 = GRB;
Gr2 = BrP;
Gr = GRB * (BrP + Gd);
% Example 198 Rotation of a body point about a global axis.
% The slab shown in Figure 2.5 is turning about the Z-axis with % a = 10 deg /s. The global velocity of the corner point P(5, 30, 10), when the slab is at ? = 30 deg, is:
%Pengujian Example 198
%definisi variabel untuk konstanta GRB
a1=sin(pi/6); a2=-cos(pi/6); a3=0;
a4=cos(pi/6); a5=-sin(pi/6); a6=0;
a7=0; a8=0; a9=0;
%matrik GRB nya
GRB = [a4 a5 a3;
a1 a4 a6;
a7 a8 a9];
GRBt = [a5 a2 a3;
a4 a5 a6;
a7 a8 a9];
%definisi variabel untuk BrP
b1=5;
b2=30;
b3=10;
BrP = [b1;b2;b3];
%nilai sudut putaran = alpha
a=10;
alpha=(a*pi)/180;
%Global positionnya
GrP = GRB * BrP;
% global velocity of the corner point
GvP = alpha * GRBt *BrP;
%——————————————————–
- Exercise No.2 halaman 81 (Body point and global rotations.)
The point P is at BrP = [1, 2, 1]T in a body coordinate B(Oxyz).
Find the final global position of P after
- A rotation of 30 deg about the X-axis, followed by a 45 deg rotation about the Z-axis
- A rotation of 30 deg about the Z-axis, followed by a 45 deg rotation about the X-axis.
Penyelesaian dengan Matlab: