how do I multiply two matrices

21 visualizaciones (últimos 30 días)
Lawrence Lee
Lawrence Lee el 27 de Dic. de 2017
Respondida: KSSV el 27 de Dic. de 2017
Hi
a = [1,2,3;9,8,7] b = [5,8;8,7;9,4] I can't figure out how a*b = [48,34;172,156]?
thanks
  1 comentario
KSSV
KSSV el 27 de Dic. de 2017
It is basic...multiplying two matrices......are you aware of how to multiply two matrices?

Iniciar sesión para comentar.

Respuesta aceptada

KSSV
KSSV el 27 de Dic. de 2017
a = [1,2,3;9,8,7] ;
b = [5,8;8,7;9,4] ;
% ab = [48,34;172,156] ;
[n,p] = size(a) ;
[p,m] = size(b) ;
C = zeros(n,m) ;
for i=1:n
for j=1:m
C(i,j)=0.0;
for k=1:p
C(i,j) = C(i,j)+a(i,k)*b(k,j);
end
end
end

Más respuestas (0)

Categorías

Más información sobre MATLAB 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