If I have a matrix, say
a = [1 2 3;
4 5 6]
and
b = [2 2 2;
3 3 3]
when I do a(b) in matlab, I get the answer as
a(b) = [4 4 4;
2 2 2]
what exactly is happening here ?
A\B returns a least-squares solution to the system of equations A*x= B.
Description. C = A . * B multiplies arrays A and B by multiplying corresponding elements. The sizes of A and B must be the same or be compatible.
Mathworks releases different Matlab versions. The four digit number represents the year in which that particular version is released and the alphabets(a/b) indicates the higher versions(b is newer version than a).
A == B will return a matrix the same size as A (and B) telling you which elements of A are equal to the corresponding element of B. isequal(A, B) will return a single true/false telling you if all the elements of A are the same as the ones in B.
You're indexing a with each item in b
. a(2) = 4
and a(3) = 2
so
c = [a(2) a(2) a(2); a(3) a(3) a(3)]
is what you're seeing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With