Main Content

rotx

Rotation matrix for rotations around x-axis

Description

R = rotx(ang) creates a 3-by-3 matrix for rotating a 3-by-1 vector or 3-by-N matrix of vectors around the x-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 x-axis by 30°. Then let the matrix operate on a vector.

R = rotx(30)
R = 3×3

    1.0000         0         0
         0    0.8660   -0.5000
         0    0.5000    0.8660

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

    2.0000
   -3.7321
    2.4641

Under a rotation around the x-axis, the x-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 x-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

Rx(α)=[1000cosαsinα0sinαcosα]

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

|