Array Operation Easy Question about formula.

조회 수: 4 (최근 30일)
Mateusz Zak
Mateusz Zak 2020년 11월 15일
댓글: Rena Berman 2021년 5월 7일
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
Stephen23
Stephen23 2020년 11월 15일
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 2021년 5월 7일
(Answers Dev) Restored edit

댓글을 달려면 로그인하십시오.

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 11월 15일
편집: Ameer Hamza 2020년 11월 15일
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
Ameer Hamza
Ameer Hamza 2020년 11월 15일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by