Hi @Antonio Olinto ,
Matrix multiplication in MATLAB can sometimes lead to confusion, especially when dealing with dimensions and orientations of matrices and vectors. Let's break down the problem step by step to clarify why the output is not as expected.
Matrix ( R ): The matrix ( R ) is defined as follows: R = 0.0000 1.0000 0 0.0000 0.0000 1.0000 1.0000 0 0.0000
This is a ( 3 times 3 ) matrix. The column vector you are multiplying with is: [1 0 0]’ is a ( 3 times 1 ) column vector, is the transpose of the row vector ([1, 0, 0]). For matrix multiplication to be valid, the number of columns in the first matrix must equal the number of rows in the second matrix. In this case:
- ( R ) is ( 3 times 3 )
- The column vector is ( 3 times 1 )
Since the dimensions align (3 columns in ( R ) and 3 rows in the column vector), the multiplication is valid.
The multiplication ( R * ([1 0 0].') ) can be computed as follows:
First Row: [ 0 cdot 1 + 1 cdot 0 + 0 cdot 0 = 0 ] Second Row: [ 0 cdot 1 + 0 cdot 0 + 1 cdot 0 = 0 ] Third Row: [ 1 cdot 1 + 0 cdot 0 + 0 cdot 0 = 1 ]
Thus, the resulting vector is:
ans = 0 0 1
So, the expected result of ([0, 1, 0]) suggests that there may have been a misunderstanding of the operation being performed. The multiplication of ( R ) with the column vector ([1, 0, 0]) does not yield ([0, 1, 0]) because the operation is fundamentally different from what was anticipated. So, in nutshell, the output you received, which is:
ans = 0 0 1
is indeed correct based on the rules of matrix multiplication. If you were expecting a different result, it may be beneficial to revisit the mathematical operations you intended to perform. If you have further questions or need clarification on specific aspects of matrix operations in MATLAB, feel free to ask!
Hope this helps.