Function Reference

Arithmetic

Utility Functions

ceil
Return the smallest integer not less than X.
cplxpair
Sort the numbers Z into complex conjugate pairs ordered by increasing real part.
del2
Calculates the discrete Laplace operator.
exp
Compute the exponential of X.
expm1
Compute exp (X) - 1 accurately in neighbourhood of zero.
factor
Return prime factorization of Q.
factorial
Return the factorial of N.
fix
Truncate X toward zero.
floor
Return the largest integer not greater than X.
fmod
Compute the floating point remainder of dividing X by Y using the C library function `fmod'.
gcd
If a single argument is given then compute the greatest common divisor of the elements of this argument.
gradient
Calculates the gradient.
hypot
Compute square-root of the squares of X and Y element-by-element.
lcm
Compute the least common multiple of the elements of X, or the list of all the arguments.
log
Compute the natural logarithm for each element of X.
log1p
Compute log (1 + X) accurately in neighbourhood of zero.
log10
Compute the base-10 logarithm for each element of X.
log2
Compute the base-2 logarithm for each element of X.
max
For a vector argument, return the maximum value.
min
For a vector argument, return the minimum value.
mod
Compute modulo function.
nextpow2
If X is a scalar, returns the first integer N such that 2^n >= abs (x).
nthroot
Compute the nth root of X, returning real results for real components of X.
pow2
With one argument, computes 2 .
primes
Return all primes up to N.
reallog
Return the real natural logarithm of X.
realpow
Return the element by element power operator.
realsqrt
Return the real sqrt of X.
rem
Return the remainder of `X / Y', computed using the expression
round
Return the integer nearest to X.
roundb
Return the integer nearest to X.
sign
Compute the "signum" function, which is defined as
sqrt
Compute the square root of X.

Complex Arithmetic

abs
Compute the magnitude of Z, defined as |Z| = `sqrt (x^2 + y^2)'.
arg
Compute the argument of Z, defined as THETA = `atan (Y/X)'.
conj
Return the complex conjugate of Z, defined as `conj (Z)' = X - IY.
imag
Return the imaginary part of Z as a real number.
real
Return the real part of Z.

Trigonometry

sin
Compute the sine of each element of X.
cos
Compute the cosine of each element of X.
tan
Compute tangent of each element of X.
sec
Compute the secant of each element of X.
csc
Compute the cosecant of each element of X.
cot
Compute the cotangent of each element of X.
asin
Compute the inverse sine of each element of X.
acos
Compute the inverse cosine of each element of X.
atan
Compute the inverse tangent of each element of X.
asec
Compute the inverse secant of each element of X.
acsc
Compute the inverse cosecant of each element of X.
acot
Compute the inverse cotangent of each element of X.
sinh
Compute the hyperbolic sine of each element of X.
cosh
Compute the hyperbolic cosine of each element of X.
tanh
Compute hyperbolic tangent of each element of X.
sech
Compute the hyperbolic secant of each element of X.
csch
Compute the hyperbolic cosecant of each element of X.
coth
Compute the hyperbolic cotangent of each element of X.
asinh
Compute the inverse hyperbolic sine of each element of X.
acosh
Compute the inverse hyperbolic cosine of each element of X.
atanh
Compute the inverse hyperbolic tangent of each element of X.
asech
Compute the inverse hyperbolic secant of each element of X.
acsch
Compute the inverse hyperbolic cosecant of each element of X.
acoth
Compute the inverse hyperbolic cotangent of each element of X.
atan2
Compute atan (Y / X) for corresponding elements of Y and X.
sind
Compute the sine of each element of X.
cosd
Compute the cosine of an angle in degrees.
tand
Compute the tangent of an angle in degrees.
secd
Compute the secant of an angle in degrees.
cscd
Compute the cosecant of an angle in degrees.
cotd
Compute the cotangent of an angle in degrees.
asind
Compute the inverse sine of an angle in degrees.
acosd
Compute the inverse cosine of an angle in degrees.
atand
Compute the inverse tangent of an angle in degrees.
asecd
Compute inverse secant in degrees.
acscd
Compute the inverse cosecant of an angle in degrees.
acotd
Compute the inverse cotangent of an angle in degrees.

Sums and Products

sum
Sum of elements along dimension DIM.
prod
Product of elements along dimension DIM.
cumsum
Cumulative sum of elements along dimension DIM.
cumprod
Cumulative product of elements along dimension DIM.
sumsq
Sum of squares of elements along dimension DIM.
accumarray
Create an array by accumulating the elements of a vector into the positions defined by their subscripts.

Special Functions

besselj
Compute Bessel or Hankel functions of various kinds:
airy
Compute Airy functions of the first and second kind, and their derivatives.
beta
For real inputs, return the Beta function,
betainc
Return the incomplete Beta function,
betaln
Return the log of the Beta function,
bincoeff
Return the binomial coefficient of N and K, defined as
erf
Computes the error function,
erfc
Computes the complementary error function, `1 - erf (Z)'.
erfinv
Computes the inverse of the error function.
gamma
Computes the Gamma function,
gammainc
Compute the normalized incomplete gamma function,
legendre
Compute the Legendre function of degree N and order M = 0 .
lgamma
Return the natural logarithm of the gamma function of X.
cross
Computes the vector cross product of the two 3-dimensional vectors X and Y.
commutation_matrix
Return the commutation matrix K(m,n) which is the unique M*N by M*N matrix such that K(m,n) * vec(A) = vec(A') for all m by n matrices A.
duplication_matrix
Return the duplication matrix Dn which is the unique n^2 by n*(n+1)/2 matrix such that Dn vech (A) = vec (A) for all symmetric n by n matrices A.

Coordinate Transformations

cart2pol
Transform cartesian to polar or cylindrical coordinates.
pol2cart
Transform polar or cylindrical to cartesian coordinates.
cart2sph
Transform cartesian to spherical coordinates.
sph2cart
Transform spherical to cartesian coordinates.

Mathematical Constants

I
Return a matrix or N-dimensional array whose elements are all equal to the pure imaginary unit, defined as `sqrt (-1)'.
Inf
Return a matrix or N-dimensional array whose elements are all Infinity.
NaN
Return a matrix or N-dimensional array whose elements are all NaN (Not a Number).
pi
Return a matrix or N-dimensional array whose elements are all equal to the ratio of the circumference of a circle to its diameter.
e
Return a matrix or N-dimensional array whose elements are all equal to the base of natural logarithms.
eps
Return a matrix or N-dimensional array whose elements are all eps, the machine precision.
realmax
Return a matrix or N-dimensional array whose elements are all equal to the largest floating point number that is representable.
realmin
Return a matrix or N-dimensional array whose elements are all equal to the smallest normalized floating point number that is representable.