@sym
: power (x, y) ¶@sym
: x .^ y ¶Symbolic expression componentwise exponentiation.
The .^
notation can be used to raise each element
of a matrix to a power:
syms x A = [sym(pi) 2; 3 x] ⇒ A = (sym 2×2 matrix) ⎡π 2⎤ ⎢ ⎥ ⎣3 x⎦ A.^2 ⇒ ans = (sym 2×2 matrix) ⎡ 2 ⎤ ⎢π 4 ⎥ ⎢ ⎥ ⎢ 2⎥ ⎣9 x ⎦
It can also be used on two matrices:
A.^[1 2; 3 4] ⇒ ans = (sym 2×2 matrix) ⎡π 4 ⎤ ⎢ ⎥ ⎢ 4⎥ ⎣27 x ⎦
See also: @sym/mpower.
Package: symbolic