MATLAB: How to multiply two matrices multiplication 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 Best Answer 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 Related SolutionsMATLAB: Do a matrix,array This works:B = reshape(A', 1, []); MATLAB: How to multiply two matrices with nested for loops A=rand(n,p);B=rand(p,m);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 endBest wishesTorsten. Related QuestionReplace one matrix with the positon indicated in another matrixHow to make a 3×3 matrix a 9×1 matrixComparing two matrices and obtain the un-repeated rowsRemoving repeated numbers in a matrixHow to convert a string contains number seperated by commas into a matrix of numbers“Kronecker” of varying dimensions
Best Answer