What is the difference between *
and .*
in Matlab?
*
is a vector or matrix multiplication
.*
is a element wise multiplication
a = [ 1; 2]; % column vector
b = [ 3 4]; % row vector
a*b
ans =
3 4
6 8
while
a.*b.' % .' means tranpose
ans =
3
8