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 toX
in the
sense that abs(N./D - X) <= tol*norm(X,1)*abs(X)
.
y=rat(x,tol)
return the quotient
N./D
The rational approximations are generated by truncating continued fraction expansions.