Subtraction between a matrix and a column vector
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Akshay Vivek Panchwagh
il 5 Apr 2022
Commentato: Akshay Vivek Panchwagh
il 12 Apr 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 Commenti
Risposta accettata
Riccardo Scorretti
il 5 Apr 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
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!