The product of a vector and a matrix
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hancheng Zhu
il 8 Dic 2023
Modificato: Dyuman Joshi
il 8 Dic 2023
I have a vector A =
and a matrix X =
, where
is a M-dimensional row vector. Does matlab have an operator that directly give me the matrix
? (where each row vector in the above matrix X is multiplied by the corresponding part in vector A)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1563479/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1563484/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1563489/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1563494/image.png)
0 Commenti
Risposta accettata
Dyuman Joshi
il 8 Dic 2023
Modificato: Dyuman Joshi
il 8 Dic 2023
If I understand your question correctly, you should get the desired output using array multiplication -
N=5;
A = (1:N).'
X = magic(N)
Z = A.*X
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrices and Arrays 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!