Main Content

roty

Rotation matrix for rotations around y-axis

Description

R = roty(ang) creates a 3-by-3 matrix used to rotate a 3-by-1 vector or 3-by-N matrix of vectors around the y-axis by ang degrees. When acting on a matrix, each column of the matrix represents a different vector. For the rotation matrix R and vector v, the rotated vector is given by R*v.

example

Examples

collapse all

Construct the matrix for a rotation of a vector around the y-axis by 45°. Then let the matrix operate on a vector.

R = roty(45)
R = 3×3

    0.7071         0    0.7071
         0    1.0000         0
   -0.7071         0    0.7071

v = [1;-2;4];
y = R*v
y = 3×1

    3.5355
   -2.0000
    2.1213

Under a rotation around the y-axis, the y-component of a vector is invariant.

Input Arguments

collapse all

Rotation angle specified as a real-valued scalar. The rotation angle is positive if the rotation is in the counter-clockwise direction when viewed by an observer looking along the y-axis towards the origin. Angle units are in degrees.

Example: 30.0

Data Types: double

Output Arguments

collapse all

3-by-3 rotation matrix returned as

Ry(β)=[cosβ0sinβ010sinβ0cosβ]

for a rotation angle β.

More About

collapse all

References

[1] Goldstein, H., C. Poole and J. Safko, Classical Mechanics, 3rd Edition, San Francisco: Addison Wesley, 2002, pp. 142–144.

Extended Capabilities

expand all

Version History

Introduced in R2013a

See Also

|