matlab 中在运算符号前加一点是什么意思?
mip版 关注:210 答案:2 悬赏:20
解决时间 2021-01-23 18:50
已解决
2021-01-23 08:24
例如,矩阵A、B,A*B和A.*B有什么区别?
最佳答案
2021-01-23 09:51
*表示矩阵相乘(矩阵的乘法)
.*表示各个元素分别相乘
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
全部回答
1楼
2021-01-23 10:54
a.*b 代表的是元素乘,即a、b对应位置的元素相乘
a*b 代表的是线性代数里的矩阵乘法
对于初学者,一般不需要矩阵乘法。所以养成在每个运算符前加个点是个好习惯。
我要举报
如果感觉以上信息为低俗/不良/侵权的信息,可以点下面链接进行举报,我们会做出相应处理,感谢你的支持!
点此我要举报以上信息!
推荐资讯
大家都在看