element wise product matrix-vector
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alex
el 4 de Abr. de 2020
Comentada: Alex
el 4 de Abr. de 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
0 comentarios
Respuesta aceptada
David Hill
el 4 de Abr. de 2020
S_t=Y_t.*w';
3 comentarios
Florian Floh
el 4 de Abr. de 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 ;)
Más respuestas (1)
Ver también
Categorías
Más información sobre Get Started with MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!