MATLAB Answers

Array Operation Easy Question about formula.

4 views (last 30 days)
Mateusz Zak
Mateusz Zak on 15 Nov 2020
Commented: Rena Berman on 7 May 2021 at 0:08
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.

Sign in to comment.

Answers (1)

Ameer Hamza
Ameer Hamza on 15 Nov 2020
Edited: Ameer Hamza on 15 Nov 2020
It was introduced in R2016b. Read all about it here: Previously such a thing was only possible through bsxfun().
  1 Comment
Ameer Hamza
Ameer Hamza on 15 Nov 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.

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!