Borrar filtros
Borrar filtros

Matrix Multiplication Help

1 visualización (últimos 30 días)
Euan
Euan el 12 de Nov. de 2011
I have 2 matrix. A=[1 2 3], B=[3 4 5 6 7 8]
What id like to do is for every value in A, multiply it by B. So end up with
C = 3 6 9
4 8 12
5 10 15
6 12 18
7 14 21
8 16 24
Any help would be much appreciated. Thanks

Respuesta aceptada

bym
bym el 12 de Nov. de 2011
  2 comentarios
Fangjun Jiang
Fangjun Jiang el 12 de Nov. de 2011
Yup! I was stuck with bsxfun() too! +1
David Young
David Young el 12 de Nov. de 2011
+1, yes, but for generality better to use .' in case b is complex.

Iniciar sesión para comentar.

Más respuestas (1)

David Young
David Young el 12 de Nov. de 2011
bsxfun(@times, A, B.')

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by