matlab中的易混运算

 1、点乘(.*)
  先贴出matlab中的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.
 
    C = times(A,B) is called for the syntax 'A .* B' when A or B is an
    object.

matlab中的易混运算

大致意思是:点乘是元素间的乘法,X和Y必须维度相同,除非一个是标量,标量可以与所有的向量相乘。这里标量可以理解为数值。

点乘的另一种形式是times(A,B),倆者结果是相同的  下面来验证一下;

matlab中的易混运算matlab中的易混运算

2:乘法(*)

matlab中的help结果

*   Matrix multiply.
    X*Y is the matrix product of X and Y.  Any scalar (a 1-by-1 matrix)
    may multiply anything.  Otherwise, the number of columns of X must
    equal the number of rows of Y.
 
    C = mtimes(A,B) is called for the syntax 'A * B' when A or B is an
    object.

matlab中的易混运算

  这个就是我们平常所说的矩阵相乘,即满足A的列数等于B的行数,用mtimes也可以表示matlab中的易混运算

matlab中的易混运算