Subtraction between a matrix and a column vector
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Akshay Vivek Panchwagh
el 5 de Abr. de 2022
Comentada: Akshay Vivek Panchwagh
el 12 de Abr. de 2022
So I have a matrix of the size 23x15 and a column vector of size 23x1. I need to subtract element 1 of the colum vector from the 1st row of the matrix, element 2 of the column vector from 2nd row of the matrix, and so on. Any suggestions about how I can do it?
0 comentarios
Respuesta aceptada
Riccardo Scorretti
el 5 de Abr. de 2022
Hi. If the matrix and the vector have compatible size (= like you mentioned), it is enough to use the minus operator:
A = rand(23,15);
x = rand(23,1);
A-x
Más respuestas (1)
Ver también
Categorías
Más información sobre Logical 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!