What kind of multiplication is going on here?

1 次查看(过去 30 天)
Apparently multiplying by '*' utilizes matrix multiplication, while multiplying by '.*' is element-wise multiplication.
So if I do in the command:
[-5: 0.1: 5]*[5]
I get an output like it's doing scalar multiplication with the 5. But I don't think a 1x101 matrix should be able to matrix multipy with a 1x1... And given that the '*' operator was used, why would there be any output at all?

采纳的回答

dpb
dpb 2021-1-16
The degenerate case of a 1x1 matrix IS a scalar and so '*' reverts to scalar operation.
It would be simply too inconvenient if it weren't the case.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by