Main Content

Exponents and Logarithms

Exponential, logarithm, power, and root functions

In addition to common functions like exp and log, MATLAB® has several other related functions to allow flexible numerical calculations. The expm1 and log1p functions compensate for numerical round-off errors in small arguments, while the reallog, realpow, and realsqrt functions restrict the range of these functions to real numbers. nthroot calculates roots of any order, while the specialized functions pow2 and nextpow2 calculate powers of two.

Functions

expExponential
expm1Compute exp(X)-1 accurately for small X
logNatural logarithm
log10Common logarithm (base 10)
log1pCompute natural logarithm of 1+X accurately for small X
log2Base 2 logarithm and floating-point number dissection
nextpow2Exponent of next higher power of 2
nthrootReal nth root of real numbers
pow2Base 2 exponentiation and scaling of floating-point numbers
reallogNatural logarithm for nonnegative real arrays
realpowArray power for real-only output
realsqrtSquare root for nonnegative real arrays
sqrtSquare root

Topics