Main Content

mpower,^

Symbolic matrix power

Syntax

Description

example

A^BcomputesAto theBpower.

mpower(A,B)相当于A^B.

Examples

Matrix Base and Scalar Exponent

创建一个2-by-2matrix.

A = sym('a%d%d', [2 2])
A = [ a11, a12] [ a21, a22]

FindA^2.

A^2
ans = [ a11^2 + a12*a21, a11*a12 + a12*a22] [ a11*a21 + a21*a22, a22^2 + a12*a21]

Scalar Base and Matrix Exponent

创建一个2-by-2symbolic magic square.

A = sym(magic(2))
A = [ 1, 3] [ 4, 2]

FindπA.

sym(pi)^A
ans = [ (3*pi^7 + 4)/(7*pi^2), (3*(pi^7 - 1))/(7*pi^2)] [ (4*(pi^7 - 1))/(7*pi^2), (4*pi^7 + 3)/(7*pi^2)]

Input Arguments

collapse all

Base, specified as a number or a symbolic number, scalar variable, function, expression, square symbolic matrix variable(since R2021a), or square matrix of symbolic scalar variables.AandBmust be one of the following:

  • Both are scalars.

  • Ais a square matrix, andBis a scalar.

  • Bis a square matrix, andAis a scalar.

Exponent, specified as a number or a symbolic number, scalar variable, function, expression, or square matrix of symbolic scalar variables.AandBmust be one of the following:

  • Both are scalars.

  • Ais a square matrix, andBis a scalar.

  • Bis a square matrix, andAis a scalar.

Version History

Introduced before R2006a