consider the two matrices a = [ 8 7 11; 6 5 -1; 0 2 -8] b = [ 2 1 2; -1 6 4; 2 2 2;] and compute in matlab

To compute the matrix multiplication of two matrices a and b, use the * operator in Matlab:

main.m
c = a * b;
11 chars
2 lines

To compute element-wise multiplication of two matrices a and b, use the .* operator in Matlab:

main.m
c = a .* b;
12 chars
2 lines

Note that element-wise multiplication requires both matrices to have the same dimensions, while matrix multiplication requires that the number of columns of the first matrix be equal to the number of rows of the second matrix.

gistlibby LogSnag