作业帮 > 综合 > 作业

matlab矩阵相乘的问题,4*1的A乘以4*4的B乘以1*4的C为什么会错!

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/10/07 02:37:20
matlab矩阵相乘的问题,4*1的A乘以4*4的B乘以1*4的C为什么会错!
B =
51 51 51 52
52 52 52 52
53 54 53 53
55 55 54 54
A =
-0.0329 0.2359 0.9259 -0.1290
C =
-0.0101
0.9998
0.0105
-0.0001
A*B*C的话会有错误
Error using *
MTIMES is not fully supported for integer classes.At least one input must be scalar.
To compute elementwise TIMES,use TIMES (.*) instead.
你那个B是个int型的数组,在进行运算前,需要转换成double型数组.
也就是在相乘之前加上:
B=double(B);