This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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.


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


Powers and Exponentials

This topic shows how to compute matrix powers and exponentials.

Graphical Comparison of Exponential Functions

This example shows an interesting graphical approach for discovering whether e^pi is greater than pi^e.