I don't really understand where I went wrong. I thought SSW means 202.5 degrees. So, I made 202.5 as my theta.
My matrix was (cos(202.5),-sin202.5,123;sin202.5,cos202.5,-74.6;0,0,1
Zeyue Xia you should use cosd and sind functions because you've specified the rotation angle in degrees not in radians.
good luck.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
T = user_function
assert(all(size(T)==3), 'The matrix must be 3x3');
assert(isreal(T), 'The matrix must be real, not complex');
T =
-0.3827 0.9239 123.0000
-0.9239 -0.3827 -74.6000
0 0 1.0000
|
2 | Pass |
T = user_function
assert(isequal(T(3,:), [0 0 1]), 'The bottom row of the homogeneous transformation matrix is not correct')
T =
-0.3827 0.9239 123.0000
-0.9239 -0.3827 -74.6000
0 0 1.0000
|
3 | Pass |
T = user_function
assert(isequal(T(1,3),123), 'The representation of the x-coordinate is not correct')
T =
-0.3827 0.9239 123.0000
-0.9239 -0.3827 -74.6000
0 0 1.0000
|
4 | Pass |
T = user_function
assert(isequal(T(2,3),-74.6), 'The representation of the y-coordinate is not correct')
T =
-0.3827 0.9239 123.0000
-0.9239 -0.3827 -74.6000
0 0 1.0000
|
5 | Pass |
T = user_function
R = T(1:2,1:2);
assert( abs(det(R)-1) < 0.01, 'The determinant of the rotation submatrix is not correct')
T =
-0.3827 0.9239 123.0000
-0.9239 -0.3827 -74.6000
0 0 1.0000
|
6 | Pass |
T = user_function
R = T(1:2,1:2);
assert( abs(atan2d(R(2,1), R(1,1)) + 112.5) < 0.1, 'The rotation matrix is not correct, check your calculation of the heading SSW and whether you are using radians or degrees')
T =
-0.3827 0.9239 123.0000
-0.9239 -0.3827 -74.6000
0 0 1.0000
|
6063 Solvers
Poker Series 01: isStraightFlush
106 Solvers
171 Solvers
36 Solvers
393 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!