Documentation

realpow

数组real-only出来put

Syntax

Z = realpow(X,Y)

Description

Z = realpow(X,Y)raises each element of arrayXto the power of its corresponding element in arrayY. ArraysXandYmust be the same size. The range ofrealpowis the set of all real numbers, i.e., all elements of the output arrayZmust be real.

Examples

collapse all

Create a 3-by-3 matrix with the same value in each element.

X = -2*ones(3,3)
X =3×3-2 -2 -2 -2 -2 -2 -2 -2 -2

Compute a 3-by-3 matrix of integer values.

Y = pascal(3)
Y =3×31 1 1 1 2 3 1 3 6

Compute the element-wise powers of the elements inXcorresponding to the exponents defined inY.

Z = realpow(X,Y)
Z =3×3-2 -2 -2 -2 4 -8 -2 -8 64

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a

Was this topic helpful?