Given that x is a 200x4 matrix and u is a 1x4 matrix of all 1s. I want to matrix multiply each row of x times u. To do this I want to transpose each row of x into a 4 by 1 matrix. multiply it by u and then set into a new matrix.
The new matrix should be 200 by 1. How can I do this in matlab?
This is the whole process. Follow this to reach the final solution.
Read and understand the process and if you find difficulty comment it. I will provide the complete code too.
But try to figure it out by yourself.
To extract rows from a matrix:
A = [1 2 3; 4 5 6];
row1 = A(1,:)
row2 = A(2,:)
So first extract all rows and transpose them using:
The syntax is as follows:
B = A.'
B = transpose(A)
Then multiply these matrices with u to get the resultant value:
The syntax is as follows:
C = A*B
C = mtimes(A,B)
Then save these all values in a column vector to get the
resultant output.
Get Answers For Free
Most questions answered within 1 hours.