What is the operator `.*` doing in matlab?

It does element-by-element multiplication. Quoting Matlab help (or see online help): .* Array multiply.X.*Y denotes element-by-element multiplication. X and Y must have the same dimensions unless one is a scalar. A scalar can be multiplied into anything. For more information see @am304’s link above.