Subtraction between a matrix and a column vector
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Akshay Vivek Panchwagh
le 5 Avr 2022
Commenté : Akshay Vivek Panchwagh
le 12 Avr 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 commentaires
Réponse acceptée
Riccardo Scorretti
le 5 Avr 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
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!