Array power for real-only output
Z = realpow(X,Y)
raises each element of array
Z = realpow(
X to the power of its corresponding
element in array
Y must be the same size or be compatible. The range of
realpow is the set of all real
numbers, i.e., all elements of the output array
Z must be
Y is a table or timetable, then
Z is a table
or timetable. (since R2023a)
Powers of Matrix Elements
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×3 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
Z = realpow(X,Y)
Z = 3×3 -2 -2 -2 -2 4 -8 -2 -8 64
Y — Operands
scalars | vectors | matrices | multidimensional arrays | tables | timetables
Operands, specified as scalars, vectors, matrices, multidimensional
arrays, tables, or timetables.
must either be the same size or have sizes that are compatible (for example,
X is an
Y is a scalar or
N row vector). For more
information, see Compatible Array Sizes for Basic Operations.
The values in
Y must be real.
Y are of integer data types,
then the values of
Y must also be nonnegative
Calculate with arrays that have more rows than fit in memory.
This function fully supports tall arrays. For more information, see Tall Arrays.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Run code in the background using MATLAB®
backgroundPool or accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Version HistoryIntroduced before R2006a
R2023a: Perform calculations directly on tables and timetables
realpow function can calculate on all variables within a table or
timetable without indexing to access those variables. All variables must have data types
that support the calculation. For more information, see Direct Calculations on Tables and Timetables.