I tried the next function, but there is an error in the decimals. I got this result:
y_correct = [0.4347 0.7167
0.2266 0.5861
0.3375 0.9331]
function Rotated_Vector = RotTimesVec(Rotation_Matrix,Vector)
[a,b,Dim] = size(Rotation_Matrix);
Rotated_Vector = [];
for n=1:Dim
Ans = Vector(:,:,n)*Rotation_Matrix(:,:,n);
Rotated_Vector = [Rotated_Vector Ans'];
end
end
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
Rotation_Matrix(:,:,1) = [0.9129 0.8099 0.0542;
0.4817 0.1868 0.6090;
0.8518 0.2472 0.7772];
Rotation_Matrix(:,:,2) = [0.5111 0.5009 0.6256;
0.0278 0.3320 0.5751;
0.9904 0.1739 0.7510];
Vector(:,:,1) = [0.1535 0.3568 0.1440];
Vector(:,:,2) = [0.8506 0.3379 0.2752];
y_correct = [0.4346 0.7166;
0.2266 0.5861;
0.3375 0.9332];
assert(isequal(RotTimesVec(Rotation_Matrix,Vector),y_correct))
|
12387 Solvers
Similar Triangles - find the height of the tree
203 Solvers
37 Solvers
Sum of diagonal of a square matrix
1327 Solvers
95 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!