Problem 44894. Orientation of a 3D coordinate frame

Solution 2058763

Submitted on 16 Dec 2019 by Binbin Qi
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

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 = 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]); z = your_fcn_name(R); assert(all(size(z) == [1 3]), 'shape of z should be 1x3'); err = abs(z*R(:,1)) + abs(z*R(:,2)) assert(sum(abs(err)) < 10*eps)

err = 1.1102e-16

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!