FUNCTION REFERENCE

rat

Rational approximation.

Rational approximation.

Syntax

S = rat(X)

Syntax

[N, D] = rat(X)

Syntax

[N, D] = rat(X, tol)

With two outputs, N./D approximates X to within tol, by default

1e-6*norm(X(:),1). With one output, the continued fraction as text, one row

per element (for example 3 + 1/(7 + 1/(16)) for pi).

Example

[n, d] = rat(0.75)   % n = 3, d = 4

Differences from MATLAB: real input only.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.