Floating point rational approximation
[N, D] = rat(X [,tol]) Y = rat(X [,tol])
real vector or matrix
real positive scalar, the tolerance (see below). Default value is 1d-6.
integer vector or matrix
integer vector or matrix
real vector or matrix
[N, D] = rat(X, tol)
returns two integer matrices
so that N./D
is close to X
in the
sense that abs(N./D - X) <= tol * norm(X, 1)
.
y = rat(x, tol)
returns the quotient
N./D
The rational approximations are generated by truncating continued fraction expansions.