Table Of Contents

rat

Version:
    Last Modified: March 15, 2017

    Approximates real or complex numbers using rational fractions.

    Syntax

    s = rat(x)
    s = rat(x, tol)
    [n, d] = rat(x)
    [n, d] = rat(x, tol)

    Inputs

    x

    Real or complex scalar, vector, or matrix.

    tol

    Tolerance of the approximation. tol is a positive real number. If tol is less than or equal to 0, MathScript uses the default value.

    Default: 1e-6*max(abs(x))

    Outputs

    s

    Approximation result as a string.

    n

    Numerators of the approximation. n is a scalar, vector, or matrix whose length is the same as that of x.

    d

    Denominators of the approximation. d is a scalar, vector, or matrix whose length is the same as that of x.

    [N, D] = rat(pi, 1e-8)

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: This product does not support FPGA devices


    Recently Viewed Topics