reallog - Natural logarithm for nonnegative real arrays - MATLAB (original) (raw)
Main Content
Natural logarithm for nonnegative real arrays
Description
`Y` = reallog([X](#mw%5F77668b57-d762-4bec-9783-596dccf47f6c))
returns the natural logarithm of each element in array X
. ArrayX
must contain only nonnegative real numbers. The size ofY
is the same as the size of X
.
If X
is a table or timetable, then Y
is a table or timetable. (since R2023a)
Examples
Create a 4-by-4 matrix and compute the natural log of each element.
X = 4×4
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
Y = 4×4
2.7726 0.6931 1.0986 2.5649
1.6094 2.3979 2.3026 2.0794
2.1972 1.9459 1.7918 2.4849
1.3863 2.6391 2.7081 0
Input Arguments
Input, specified as a scalar, vector, matrix, multidimensional array, table, or timetable. The values in X
must be nonnegative and real.
Data Types: single
| double
| table
| timetable
Extended Capabilities
Thereallog
function fully supports tall arrays. For more information, see Tall Arrays.
The reallog
function supports GPU array input with these usage notes and limitations:
If the output of the function running on the GPU can be complex, then you must explicitly specify its input arguments as complex. For more information, see Work with Complex Numbers on a GPU (Parallel Computing Toolbox).
For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced before R2006a
The reallog
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.