This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Array power for real-only output


Z = realpow(X,Y)


Z = realpow(X,Y) raises each element of array X to the power of its corresponding element in array Y. Arrays X and Y must be the same size. The range of realpow is the set of all real numbers, i.e., all elements of the output array Z must be real.


collapse all

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

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

    -2    -2    -2
    -2    -2    -2
    -2    -2    -2

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

Y = pascal(3)
Y =

     1     1     1
     1     2     3
     1     3     6

Compute the element-wise powers of the elements in X corresponding to the exponents defined in Y.

Z = realpow(X,Y)
Z =

    -2    -2    -2
    -2     4    -8
    -2    -8    64

More About

collapse all

Tall Array Support

This function fully supports tall arrays. For more information, see Tall Arrays.

See Also

| | |

Introduced before R2006a

Was this topic helpful?