matlab 中在运算符号前加一点是什么意思?

例如,矩阵A、B,A*B和A.*B有什么区别?

第1个回答  推荐于2017-09-26
*表示矩阵相乘(矩阵的乘法)
.*表示各个元素分别相乘
a=[0 1;2 3];
>> b=[3 2;0 1];
>> c=a*b

c =

0 1
6 7
%
c=[ 0*3+1*0 0*2+1*1
2*3+3*0 2*2+3*1]
%
>> c=a.*b

c =

0 2
0 3
%
c=[ 0*3 1*2
2*0 3*1]
%

>> 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.

See also times.

Overloaded methods:
gf/mtimes
codistributed/mtimes
LagOp/mtimes
fints/mtimes
idmodel/mtimes
localpoly/mtimes
icsignal/mtimes
InputOutputModel/mtimes
cvdata/mtimes
timeseries/mtimes
laurpoly/mtimes
laurmat/mtimes

Reference page in Help browser
doc mtimes

>> 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.

See also mtimes.

Overloaded methods:
gf/times
codistributed/times
fints/times
DynamicSystem/times
cvdata/times
categorical/times
timeseries/times

Reference page in Help browser
doc times本回答被提问者采纳
相似回答