[N, D] = rat(X)
[N, D] = rat(X, tol)
S = rat(X)
S = rat(X, tol)
| Parameter | Description |
|---|---|
| X | Input array: real or complex, scalar, vector or matrix (single or double). |
| tol | Tolerance: scalar. The default is 1e-6 * norm(X(:), 1). |
| Parameter | Description |
|---|---|
| N | Numerator: array of the same size as X, or the continued fraction character array when a single output is requested. |
| D | Denominator: array of the same size as X. |
[N, D] = rat(X) returns two integer arrays so that N ./ D is close to X in the sense that abs(N ./ D - X) <= tol.
The rational approximations are generated by truncating continued fraction expansions.
S = rat(X) returns the continued fraction representation as a character array.
[N, D] = rat(pi)
S = rat(pi)
| Version | Description |
|---|---|
| 2.0.0 | initial version |