Mathematics > Elementary Math

130 functions in MATLAB › Mathematics > Elementary Math.

Complex Numbers

absAbsolute value of real numbers and magnitude of complex numbers.
anglePhase angle of complex numbers.
complexCreates a complex array from real and imaginary parts.
conjComplex conjugate of each element.
cplxpairSorts complex numbers into conjugate pairs.
iImaginary unit, the square root of -1.
imagImaginary part of a complex number.
jImaginary unit, equivalent to i.
realReal part of a complex number.
signSign of each element: -1, 0 or 1.
unwrapRemoves jumps of more than pi in a phase sequence by adding multiples of 2*pi.

Trigonometry

acosInverse cosine of each element, with the result in radians.
acosdInverse cosine of each element, with the result in degrees.
acoshInverse hyperbolic cosine of each element, with the result in radians.
acotInverse cotangent of each element, with the result in radians.
acotdInverse cotangent of each element, with the result in degrees.
acothInverse hyperbolic cotangent of each element.
acscInverse cosecant of each element, with the result in radians.
acscdInverse cosecant of each element, with the result in degrees.
acschInverse hyperbolic cosecant of each element.
asecInverse secant of each element, with the result in radians.
asecdInverse secant of each element, with the result in degrees.
asechInverse hyperbolic secant of each element.
asinInverse sine of each element, with the result in radians.
asindInverse sine of each element, with the result in degrees.
asinhInverse hyperbolic sine of each element.
atanInverse tangent of each element, with the result in radians.
atan2Four-quadrant inverse tangent.
atan2dFour-quadrant inverse tangent, with the result in degrees.
atandInverse tangent of each element, with the result in degrees.
atanhInverse hyperbolic tangent of each element.
cart2polConverts Cartesian coordinates to polar or cylindrical.
cart2sphConverts Cartesian coordinates to spherical coordinates.
cosCosine of an angle given in radians.
cosdCosine of an angle given in degrees.
coshHyperbolic cosine of each element.
cospiAccurate cosine of X times pi.
cotCotangent of an angle given in radians.
cotdCotangent of an angle given in degrees.
cothHyperbolic cotangent of each element.
cscCosecant of an angle given in radians.
cscdCosecant of an angle given in degrees.
cschHyperbolic cosecant of each element.
deg2radConverts angles from degrees to radians.
hypotSquare root of the sum of squares, without overflow.
pol2cartConverts polar or cylindrical coordinates to Cartesian.
rad2degConverts angles from radians to degrees.
secSecant of an angle in radians, 1/cos(x).
secdSecant of an angle in degrees.
sechHyperbolic secant, 1/cosh(x).
sinSine of an angle in radians.
sindSine of an angle in degrees.
sinhHyperbolic sine.
sinpiSine of pi times x, exact at integer and half-integer multiples.
sph2cartConverts spherical coordinates to Cartesian.
tanTangent of an angle in radians.
tandTangent of an angle in degrees.
tanhHyperbolic tangent.

Special Functions

airyAiry functions and their derivatives.
besselhBessel function of the third kind (Hankel function).
besseliModified Bessel function of the first kind.
besseljBessel function of the first kind.
besselkModified Bessel function of the second kind.
besselyBessel function of the second kind.
betaBeta function of two arguments.
betaincRegularized incomplete beta function.
betaincinvInverse of the regularized incomplete beta function.
betalnNatural logarithm of the beta function.
ellipjJacobi elliptic functions sn, cn and dn.
ellipkeComplete elliptic integrals of the first and second kind.
erfError function of real values.
erfcComplementary error function.
erfcinvInverse of the complementary error function.
erfcxScaled complementary error function, exp(x^2) times erfc(x).
erfinvInverse error function.
expintExponential integral E1(x).
gammaGamma function, the extension of the factorial to real numbers.
gammaincRegularized incomplete gamma function.
gammaincinvInverse of the regularized incomplete gamma function.
gammalnNatural logarithm of the gamma function.
legendreAssociated Legendre functions of degree n.
psiDigamma function and its higher derivatives (polygamma).

Constants and Test Matrices

companCompanion matrix of a polynomial.
galleryCollection of named test matrices.
hadamardHadamard matrix of +1 and -1 entries.
hankelHankel matrix, constant along each anti-diagonal.
hilbHilbert matrix, with entries 1/(i+j-1).
invhilbExact inverse of the Hilbert matrix.
magicMagic square: equal row, column and diagonal sums.
pascalPascal matrix built from binomial coefficients.
piThe constant pi, the ratio of a circle's circumference to its diameter.
rosserRosser matrix, a classic eigenvalue test matrix.
toeplitzBuilds a Toeplitz matrix, with constant values along each diagonal.
vanderVandermonde matrix whose columns are decreasing powers of the input vector.
wilkinsonWilkinson's symmetric tridiagonal eigenvalue test matrix of order n.

Polynomials

convConvolution of two vectors, or polynomial multiplication.
deconvDeconvolution and polynomial division.
polyCoefficients of the polynomial with given roots, or the characteristic polynomial of a matrix.
polyderDerivative of a polynomial, or of a product or quotient of polynomials.
polyeigEigenvalues of a polynomial eigenvalue problem.
polyfitLeast-squares polynomial fit to data.
polyintIntegral of a polynomial.
polyvalEvaluates a polynomial at given points.
polyvalmEvaluates a polynomial with a square matrix as the variable.
residuePartial fraction expansion of a ratio of polynomials.
rootsRoots of a polynomial.

Exponents and Logarithms

expExponential function e^x, element by element.
expm1Accurate exp(x) - 1 for small x.
logNatural logarithm, element by element.
log10Common (base 10) logarithm.
log1pAccurate log(1 + x) for small x.
log2Base-2 logarithm.
nextpow2Exponent of the next power of two at or above abs(x).
nthrootReal n-th root of a real number.
pow2Power of two, or a number scaled by a power of two.
reallogNatural logarithm that errors on complex results.
realpowElement-wise power that errors on complex results.
realsqrtSquare root that errors on complex results.
sqrtSquare root, element by element.

Discrete Math

factorPrime factorization of a positive integer.
factorialFactorial n! of nonnegative integers.
gcdGreatest common divisor of integers.
isprimeTests which elements are prime numbers.
lcmLeast common multiple of integers.
matchpairsOptimal assignment of rows to columns of a cost matrix.
nchoosekBinomial coefficient: the number of ways to choose k of n items.
permsAll permutations of the elements of a vector.
primesList of all prime numbers up to a limit.
ratRational approximation of a number by continued fractions.
ratsRational output: a number formatted as a fraction in a string.