element wise product matrix-vector

16 vues (au cours des 30 derniers jours)
Alex
Alex le 4 Avr 2020
Commenté : Alex le 4 Avr 2020
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:
How can I do that?
Thank you

Réponse acceptée

David Hill
David Hill le 4 Avr 2020
  3 commentaires
Florian Floh
Florian Floh le 4 Avr 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 ;)
Alex
Alex le 4 Avr 2020
thank's

Connectez-vous pour commenter.

Plus de réponses (1)

Torsten
Torsten le 4 Avr 2020
Y_t = bsxfun(@times,Y_t,w)

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!

Translated by