Problem 44893. Create a 3D rotation matrix from roll-pitch-yaw angles

Solution 1795966

Submitted on 23 Apr 2019 by Stephen Little
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
rpy = (rand(1,3)-0.5)*pi; r = rpy(1); p = rpy(2); y = rpy(3); R_correct = reshape([cos(p).*cos(y),cos(p).*sin(y),-sin(p),-cos(r).*sin(y)+cos(y).*sin(p).*sin(r),cos(r).*cos(y)+sin(p).*sin(r).*sin(y),cos(p).*sin(r),sin(r).*sin(y)+cos(r).*cos(y).*sin(p),-cos(y).*sin(r)+cos(r).*sin(p).*sin(y),cos(p).*cos(r)],[3,3]); assert(isequal(your_fcn_name(rpy),R_correct)) err = R_correct' * your_fcn_name(rpy) - eye(3,3); assert(sum(sum(abs(err))) < 10*eps)

Suggested Problems

More from this Author16

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!