A .^ B
A .^ b
A .^ B raises the elements of A to the power of the elements of B (B is a matrix). A .^ B is the matrix with elements A(i,j)^B(i,j).
A .^ b raises the elements of A to the power of b (b is a scalar). A.^b is the matrix with elements A(i,j)^b.
A |
B |
A .^ B |
[1,-2,-4,2] |
[1,2,1,4] |
[1,4,-4,16] |
[2,2;3,2] |
[1,0;3,4] |
[2,1;27,16] |
A |
b |
A .^ b |
[1, 2; 3, 4] |
2 |
[1, 4; 9, 16] |
[16, 4] |
0.5 |
[4, 2] |
The A and B matrices must have the same size or b should be a scalar.