Dividing a Matrix with a column vector
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lorenzo Pinna
el 28 de En. de 2021
Comentada: Lorenzo Pinna
el 28 de En. de 2021
Hello everyone.
I am having a problem doing a matrix by vector division. The matrices and vectors are here attached.
The operation would be q_i(10000 X 4)= p_i (10000X4)./P(1X4).
The result should be that each element of the coloumn of p_i have to be divided by the element of P of that column. Thus, giving a result different for each column (equal within the columns since the matrix p_i has this peculiarity). Instead, in my case, the outcome is a matrix 100000X4 whose elements are all equal. I am not able at all in managing this problem. If someone can help me to solve this I would be very grateful.
Thanks!
Lorenzo
0 comentarios
Respuesta aceptada
Jan
el 28 de En. de 2021
The p_i, you have provided, is not [10000 x 4] but [4 x 10000]. When I load the files and run:
q_i = p_i.' ./ P;
I get a [10000 x 4] matrix with different values as expected.
Therefore it is not clear, how you have created your q_i. The problem must be a a location, you did not mention yet.
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!