These are the operators followed by a dot, they implement
element by element operations. They do not follow the rules govern by Linear Algebra
for matrix. If we are implementing array arithmetic operators (dot operators)
on an m×n matrix, our result will also be a matrix of same order and length but
values of elements of matrix will change according to operator.
?
.+ and .- do not exist because these operations are same in matrix and arrays.
Some Dot Operators/AAO are;
.× (multiplication)
|
.^ (Power Operator)
|
./ (Left Division)
|
.\ (Right division)
|
Example
Code:
a=[1 2;3 4]
b=a.*2
result:
a = 1 2
3 4
b = 2 4
6 8
|
Example
Code:
a=[1 2;3 4]
b=a.^2
result:
a
= 1 2
3
4
b
= 1 4
9
16
|
Example
Code:
a=[1 2;3 4]
b=a./2
result:
a = 1 2
3 4
b = 0.5 1.0
1.5 2.0
|
Example
Code:
a=[1 2;3 4]
b=a.\2
result:
a = 1 2
3 4
b = 2.0 1.0
0.6 0.5
|
0 comments:
Post a Comment