What kind of multiplication is going on here?

1 Ansicht (letzte 30 Tage)
Abu Abdullah
Abu Abdullah am 16 Jan. 2021
Beantwortet: dpb am 16 Jan. 2021
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?

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by