What kind of multiplication is going on here?
1 view (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
dpb
on 16 Jan 2021
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 Comments
More Answers (0)
See Also
Categories
Find more on Multidimensional Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!