Array Operation Easy Question about formula.

4 visualizaciones (últimos 30 días)
Mateusz Zak
Mateusz Zak el 15 de Nov. de 2020
Comentada: Rena Berman el 7 de Mayo de 2021
Hello
Why this equation is possible to solve in the current matlab, despite the fact that a few years ago it was impossible ?
X = [ 1;2;3] Y = [ 4;5;6] X'.*Y.
MATLAB R202b
  3 comentarios
Stephen23
Stephen23 el 15 de Nov. de 2020
Original question by Mateusz Zak:
Array Operation Easy Question about formula.
Hello
Why this equation is possible to solve in the current matlab, despite the fact that a few years ago it was impossible ?
X = [ 1;2;3] Y = [ 4;5;6] X'.*Y.
MATLAB R202b
Original comment by Mateusz Zak:
Sorry.
X = [ 1;2;3] Y = [ 4;5;6] X'.*Y
Rena Berman
Rena Berman el 7 de Mayo de 2021
(Answers Dev) Restored edit

Iniciar sesión para comentar.

Respuestas (1)

Ameer Hamza
Ameer Hamza el 15 de Nov. de 2020
Editada: Ameer Hamza el 15 de Nov. de 2020
It was introduced in R2016b. Read all about it here: https://blogs.mathworks.com/loren/2016/10/24/matlab-arithmetic-expands-in-r2016b/. Previously such a thing was only possible through bsxfun().
  1 comentario
Ameer Hamza
Ameer Hamza el 15 de Nov. de 2020
Yes, MATLAB automatically expand both matrices to have equal size and then use element-wise operation. In your case X' is [1x3] and Y is [3x1]. MATLAB repeat elements of X' and Y to make them 3x3 matrices.

Iniciar sesión para comentar.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by