Nelson banner
Elementary functions

The Elementary Functions module provides fundamental mathematical operations and matrix manipulations in Nelson.

It includes numeric computations, array and matrix operations, complex number handling, rounding and scaling, and various utility functions for querying properties of arrays and matrices.

The module also supports construction of special matrices, grids, and sequences, enabling robust and efficient implementation of mathematical algorithms and numerical analyses.

Array Creation and Shape

Functions for creating, reshaping, and arranging arrays.

  • blkdiag
    Block diagonal matrix
  • deal
    Distribute inputs to outputs.
  • linspace
    linearly spaced vector constructor.
  • logspace
    logarithmically spaced vector constructor.
  • meshgrid
    Cartesian rectangular grid in 2-D or 3-D.
  • ndgrid
    Rectangular grid in N-D space
  • repelem
    Repeat copies of array elements.
  • repmat
    Replicate and tile an array.
  • reshape
    Reshapes a vector or a matrix to a different size matrix.
  • squeeze
    Remove dimensions of length 1.
Elementary Math

Elementary numerical functions, norms, rounding, powers, roots, logarithms, and remainders.

  • abs
    Absolute value
  • bsxfun
    Apply element-wise function with implicit expansion.
  • ceil
    Round up
  • clip
    Limit values to a range.
  • exp
    Exponential
  • expm1
    Compute exp(x) - 1.
  • factorial
    Factorial function
  • fix
    Round towards zero
  • floor
    Round down
  • hypot
    Square root of sum of squares
  • idivide
    Integer division with rounding option.
  • log
    Natural logarithm.
  • log10
    Common logarithm (base 10).
  • log1p
    log(1 + x) accurately for small values of x.
  • log2
    dissect floating-point numbers into base 2 exponent and mantissa.
  • maxk
    k largest elements of an array
  • mink
    k smallest elements of an array
  • mod
    Modulus after division.
  • nchoosek
    Binomial coefficient or combinations.
  • nextpow2
    Exponent of next higher power of 2
  • norm
    Matrix and vector norms
  • normest
    2-norm estimate
  • nthroot
    The real ๐‘›th root of real number.
  • perms
    All possible permutations.
  • pinv
    Moore-Penrose pseudoinverse
  • pow2
    Base 2 exponentiation and scaling of floating-point numbers.
  • rat
    Rational fraction approximation.
  • rats
    Rational output.
  • rem
    Remainder after division.
  • round
    Round to nearest integer
  • sign
    Find the sign function of a number.
  • sqrt
    Square root.
Complex Numbers

Functions for complex values and real-valued variants of elementary functions.

  • angle
    Phase angle
  • complex
    Creates an complex number.
  • conj
    Complex conjugate
  • imag
    Imaginary part of an complex number.
  • real
    Real part of an complex number.
  • reallog
    Natural logarithm with real-only result.
  • realpow
    Element-wise power with real-only result.
  • realsqrt
    Square root with real-only result.
  • unwrap
    Shift phase angles to remove jumps.
Base Conversions

Functions for numeric base conversion, type conversion, and byte order.

  • base2dec
    Convert number in a base to decimal.
  • bin2dec
    Convert number in base 2 to decimal.
  • bin2num
    Convert two's complement binary string to number.
  • cast
    Converts variable to a different data type
  • dec2base
    Convert decimal number to another base.
  • dec2bin
    Convert decimal number to base 2.
  • dec2hex
    Convert decimal number to base 16.
  • hex2dec
    Convert number in base 16 to decimal.
  • hex2num
    Convert an IEEE hexadecimal representation to a number.
  • num2bin
    Convert number to binary representation.
  • num2hex
    Convert a number to its IEEE hexadecimal representation.
  • swapbytes
    Swap byte ordering.
  • typecast
    Convert data type without changing underlying data.
Matrix Generation

Functions for generating special matrices.

Indexing and Dimensions

Functions for indexing, dimensions, shape checks, rearrangement, and structural predicates.

  • allfinite
    Check if all array elements are finite.
  • circshift
    Circular shift
  • filter
    1-D digital filter
  • find
    Find Non-zero Elements
  • flip
    Flip order of elements
  • flipdim
    Flip array along specified dimension
  • fliplr
    Flip order of elements left to right
  • flipud
    Flip order of elements up to dow
  • histc
    Histogram count with explicit edges.
  • histcounts
    Histogram bin counts.
  • histcounts2
    Bivariate histogram bin counts.
  • ind2sub
    Linear index to matrix subscript values
  • ipermute
    Inverse permute array dimensions.
  • isapprox
    Return true if arguments are approximately equal, within the precision.
  • iscolumn
    Determine whether input is column vector.
  • istriu
    Checks if matrix is diagonal.
  • isequal
    Return true if all arguments x1, x2, ... , xn are equal (same dimensions, same values).
  • isequaln
    Return true if all arguments x1, x2, ... , xn are equal (same dimensions, same values or NaNs).
  • isequalto
    Return true if all arguments x1, x2, ... , xn are equal (same type, same dimensions, same values or NaNs).
  • isequalwithequalnans
    Compare arrays while treating NaN values as equal.
  • isfinite
    Check for finite entries.
  • isinf
    Check for Infinity entries.
  • ismatrix
    determines whether input is matrix or not
  • isnan
    Check for Not a Number entries.
  • isrow
    Determine whether input is row vector.
  • isscalar
    Check if the input is a scalar
  • istril
    Checks if matrix is lower triangular.
  • istriu
    Checks if matrix is upper triangular.
  • isvector
    Checks input is vector.
  • length
    Length of an object.
  • ndims
    Number of dimensions of an array.
  • numel
    Number of elements.
  • permute
    Permute array dimensions.
  • rot90
    Rotate array 90 degrees.
  • shiftdim
    Shift array dimensions
  • size
    Size of an object.
  • sortrows
    Sort rows of an array.
  • sub2ind
    Matrix subscript values to linear index
  • substruct
    Create structure argument for subsasgn or subsref
  • tril
    Lower triangular part of matrix
  • triu
    Upper triangular part of matrix