Q&A
Ask and answer questions to make information more available to wider audiences.
Easton Milostan @eastonmilostan   18, Aug 2023 12:00 AM
difference between * and .*
What is the difference between * and .* in MATLAB?
answers 2
 
Answer 1
Cesar Borne @bornecesar   30, Aug 2023 05:22 PM
For example,

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
 
Answer 2
Cesar Borne @bornecesar   30, Aug 2023 05:21 PM
* is a vector or matrix multiplication, in order to use this operator, the operands should obey matrix multiplication rules in terms of size.
.* is a element-wise multiplication. In order to use this operator, vector lengths or matrix sizes should be equal.