When multiplying or dividing a vector by a scaler, when do you need a period before the operator?

10 visualizaciones (últimos 30 días)
This was a question I had, the picture of the problem and the correct answer is attached, thanks.

Respuestas (1)

Stephen23
Stephen23 el 5 de Mayo de 2024
Editada: Stephen23 el 5 de Mayo de 2024
"When multiplying or dividing a vector by a scaler, when do you need a period before the operator?"
Lets consider multiplying.
There is no "period before the operator": this is the complete operator: .*
This is another, different, complete operator: *
You use MTIMES whenever you want to perform matrix multiplication of two matrices. If you do not know how matrix multiplication is defined then there are many tutorials online.
You use TIMES whenever you want to perform element-wise multiplication of array elements. As a rule of thumb, if you are not doing linear algebra then you probably want to use element-wise array operations.
The same basic concepts apply to multiplication, division, power:
Note that even though you asked about dividing a vector by a scalar, the screenshot you pasted actually shows dividing a scalar by a vector. Getting things mixed up makes writing and understanding code much harder.

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by