dot product between two different size of matrix

42 visualizaciones (últimos 30 días)
Alan
Alan el 18 de Dic. de 2020
Comentada: James Tursa el 14 de Dic. de 2021
Hello,
I have two matrix, one is A (1by 3 matrix), the other one is B (86 by 3 matrix). And I would like to calculate the dot product of dot(A,B). However, A and B are not the same size, so dot(A,B) function can not be performed successfullly.
How can I calculate the dot product between two different size of matrix without using for loop?
Many thanks!

Respuesta aceptada

Ive J
Ive J el 18 de Dic. de 2020
X = sum(bsxfun(@times, A, B), 2);

Más respuestas (1)

James Tursa
James Tursa el 18 de Dic. de 2020
Assuming everything is real and by "dot product" you aren't involving complex conjugates, simply this
C = B * A';
  3 comentarios
Prajwal Sridhar
Prajwal Sridhar el 9 de Dic. de 2021
Is this same if i have matrix which is 50x2 and 2x2?
James Tursa
James Tursa el 14 de Dic. de 2021
@Prajwal Sridhar Try it and see if it does what you want. If it doesn't, then open up a new Question and post a small example of inputs and desired output.

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices 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