Lecture 2

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5

Q1.

The coordinates of point P in frame (B) is [0,2,0] T, frame (B) is rotated


about z-axis ccw from frame (A). Find the coordinates of the point P with respect
to
frame (A)

A. Position of P with respect to B = bP


Rotation matrix for frame (B) relative to frame (A) =aRb
Position of P with respect to A = aP = aRb * bP

Matlab Code :

aRb = [cosd(30) -sind(30) 0; sind(30) cosd(30) 0; 0 0 1];


bP = [0; 2; 0];
aP = aRb * bP

Result :
aP = [-1, 1.732, 0] T

Q2. Vector AP1

is given by [0, 2, 0]T , Compute the vector AP2 obtained by rotating

this vector about z-axis by 30 deg .

Note : The rotation matrix that rotates vectors by 30 deg about z-axis is same as
the rotation
matrix that describes a frame rotated 30 deg about z-axis relative to the reference
frame. Hence
the rotational matrix is same as previous question

A. Position vector = P1
Rotation matrix for rotating vector by 30 deg = Rz = aRb
New position vector = P2 = Rz * P1

Matlab Code :

Rz = [cosd(30) -sind(30) 0; sind(30) cosd(30) 0; 0 0 1];


P1 = [0; 2; 0];
P2 = Rz * P1

Result :
P2 = [-1, 1.732, 0] T

Q3. The coordinates of point P in frame (1) is [3, 2, 1] T, the position vector P
is
rotated about z-axis by 45-deg. Find the coordinates of point Q the new position of
point P

A. Position of point P = P
Rotation matrix for rotating vector by 30 deg = Rz
Position of point Q = Q = Rz * P

Matlab Code :

Rz = [cosd(45) -sind(45) 0; sind(45) cosd(45) 0; 0 0 1];


P = [3; 2; 1];
Q = Rz * P

Result :
Q = [0.7071, 3.5355, 1] T

Q4. The coordinates of point P in frame (B) is [3, 7, 0, 1] T, frame (B) which is
rotated relative to frame (A) about z-axis by 30-deg, translated by 10 units in x-
axis,
5 units in y-axis, 10 units in x-axis. Find coordinates of point P with respect to
frame
(A).

A. Position of point P in frame (B) = bP


Translation matrix of frame (A) with respect to frame (B) = aTb
Position of point P in frame (A) = aTb * aP

Matlab Code :

aTb = [cosd(30) -sind(30) 0 10; sind(30) cosd(30) 0 5; 0 0 1 0; 0 0 0 1];


bP = [3; 7; 0; 1];
aP = aTb * bP

Result :
aP = [9.098, 12.562, 0, 1] T

Q5. The coordinates of point P in frame (A) is [3, 7, 0, 1] T, Position vector is


rotated

about z-axis by 30 deg, translated by 10 units in x-axis, 5 units in y-axis, 10


units in x-
axis. Find new coordinate of point P.

A. Position of point P = P1
Translation and rotational matrix = T
New position of point P = P2 = T * P1

Matlab Code :

T = [cosd(30) -sind(30) 0 10; sind(30) cosd(30) 0 5; 0 0 1 0; 0 0 0 1];


P1 = [3; 7; 0; 1];
P2 = T * P1

Result :
P2 = [9.098, 12.562, 0, 1] T

Q6. Frame (B) that is rotated relative to frame (A) about z-axis by 30 deg and
translated 4 units in x-axis, 3 units in y-axis, Thus we have a description of
transformation matrix for B with respect to A. Find transformation matrix for A
with
respect to B.

A. Transformation matrix for B with respect to A = aTb

Transformation matrix for A with respect to B = bTa

aTb = [ cos(30) –sin(30) 0 4; sin(30) cos(30) 0 3; 0 0 1 0; 0 0 0 1]

Matlab Code :

aTb = [ cosd(30) -sind(30) 0 4; sind(30) cosd(30) 0 3; 0 0 1 0; 0 0 0 1];


aRb = [ cosd(30) -sind(30) 0; sind(30) cosd(30) 0; 0 0 1;];
bRa = aRb.';
D = [aTb(1:3,4)]
bTa= [bRa -bRa*D;0 0 0 1]

Result :
bTa = [ 0.866 0.5 0 -4.9641; -0.5 0.866 0 -0.5981; 0 0 1 0; 0 0 0 1]

Q7. Frame (2) is rotated with respect to frame (1) about the x-axis by an angle of
60-deg. The position of the origin of frame (2) as seen from frame (1) is 1D2 = [7,
5, 7]T . Obtain the transformation matrix 1T2

, which describes frame (2) relative to frame(1). Also find the description of
point P in frame (1). If 2P = [2, 4, 6 ]T
.

A. Transformation matrix for frame (2) with respect to frame (1) = T12

Coordinates for point P with respect to frame (2) = 2P = P


Rotational matrix for rotation about x-axis = Rx
Translational matrix for frame (2) with respect to frame (1) = D12
Coordinates for point P with respect to frame (1) = 1P = Pnew = T12 * P
Matlab Code :

Rx=[1 0 0; 0 cosd(60) -sind(60); 0 sind(60) cosd(60)];


D12 = [7; 5; 7];
P = [2; 4; 6; 1];
T12 = [Rx D12; 0 0 0 1];
Pnew = T12 * P

Result :
Pnew = [9 1.8308 13.4641 1 ]T

Q8. Consider a point P in space. Determine the new location of this point after
rotating it by an angle of 45 deg. About z-axis and then translating -1 unit along
x-axis
and -2 units along z-axis. What will be the equivalent frame transformation for
this
vector transformation.

A. Transformation matrix = T
Coordinate for point P =P
Equivalent transformation = E =T * P

Matlab Code :

E = [ cos(45) –sin(45) 0 -1; sin(45) cos(45) 0 0; 0 0 1 -2; 0 0 0 1]


E = T * P

Q9. The moving coordinate frame [u v w] undergoes a screw transformation, that


is, it is translated by 4 units along z-axis and rotated by angle of 180 deg about
same
axis of stationary reference coordinate frame (x y z) are initially coincident
1. Obtain the homogenous transformation matrix for the screw transformation
2. If the order of transformations is reversed, will the homogenous screw
transformation matrix change.
A. Rotational matrix about z-axis = Rz
4 unit translational about z-axis = Tz
Overall transformation matrix = T1
Overall transformation matrix after process reversal = T2
Matlab Code :
Rz = [cosd(180) –sind(180) 0 0; sind(180) cosd(180) 0 0; 0 0 1 0; 0 0 0 1]
Tz = [-1 0 0 0; 0 -1 0 0; 0 0 1 4; 0 0 0 1]
T1 = Rz * Tz
T2 = Tz * Rz
Result :
T1 = [ -1 0 0 0; 0 -1 0 0; 0 0 1 4; 0 0 0 1]
Since T1 and T2 are the same it can confirmed that the overall transformation will
not
change and this property of screw transformation

Q10. The position of a frame after fixed angle rotation is known. Determine the
different fixed angles of rotation.

P =
0.3536 −0.5732 0.7392
0.6124 0.7392 0.2803
0.7071 0.3536 0.6124

A. β = atan2 ( −r31, root (r^2 11 + r^2 21)

α = atan2 ( ൗ
r21
cos β
,ൗ
r11
cos β
)

γ = atan2 ( ൗ
r32
cos β
,ൗ
r33
cos β
)

Matlab Code :

P=[0.3536 -0.5732 0.7392; 0.6124 0.7392 0.2803; 0.7071 0.3536 0.6124];


B = atan2(-P(3,1),sqrt(P(1,1)^2+P(2,1)^2))*180/pi
A = atan2(P(2,1)/cosd(B),P(1,1)/cosd(B))*180/pi
Y = atan2(P(3,2)/cosd(B),P(3,3)/cosd(B))*180/pi

Result :
B = -44.9978 deg A = 59.9978 deg Y = 30.0022 deg

Q11. The coordinates of point P with respect to a moving coordinate frame are
given as P = [0.5, 0.8, 1.3, 1 ]T . What are the coordinates of P with respect to
fixed
coordinate frame, if the moving frame is rotated by 90 deg about z-axis of the
fixed
frame ?

A. Let the moving frame be denoted as ′2′


Let the fixed frame be denoted as ′1′
Coordinate of point P with respect to moving frame = P2
Rotational matrix about z-axis = Rz
Coordinate of point P with respect to fixed frame = P1 = Rz * P2
Matlab Code :

Rz= [cosd(90) -sin(90) 0 0; sin(90) cos(90) 0 0; 0 0 1 0;0 0 0 1 ];


P2 = [0.5; 0.8; 1.3; 1]
P1 = Rz * P2

Result :
P1 = [-0.8; 0.5; 1.3; 1 ]

You might also like