element wise product matrix-vector
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a 200x5 matrix (Y) that includes 5 time series and a 5x1 vector of weights (w). For each t (row of the matrix), I need to compute the following element-wise product:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/281818/image.png)
How can I do that?
Thank you
0 Kommentare
Akzeptierte Antwort
David Hill
am 4 Apr. 2020
S_t=Y_t.*w';
3 Kommentare
Florian Floh
am 4 Apr. 2020
No, David's code does work. Matlab is smart enough to recognize, that the dimensions do not agree, so it performs it for each row.
But in theory, you are right, Alex. The Hadamard product requires to have matrices who's dimensions do match ;)
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!