element wise product matrix-vector

7 ビュー (過去 30 日間)
Alex
Alex 2020 年 4 月 4 日
コメント済み: Alex 2020 年 4 月 4 日
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

採用された回答

David Hill
David Hill 2020 年 4 月 4 日
  3 件のコメント
Florian Floh
Florian Floh 2020 年 4 月 4 日
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 2020 年 4 月 4 日
thank's

サインインしてコメントする。

その他の回答 (1 件)

Torsten
Torsten 2020 年 4 月 4 日
Y_t = bsxfun(@times,Y_t,w)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by