inf
Creates arrays filled with positive infinity.
Category: Other public functions: elmat
Syntax
x = inf
The scalar Inf.
x = inf(n)
An n-by-n matrix of Inf.
x = inf(sz1, ..., szN)
An array with the given dimensions.
x = inf(___, classname)
Creates the array as 'double' or 'single'.
x = inf(___, 'like', p)
Uses the class of the variable p.
Description
Inf is the IEEE value that results from overflow or from dividing a nonzero number by zero, and it compares larger than every finite number. inf(2, 3) builds a 2-by-3 matrix of them, useful as a starting value for a running minimum: best = inf; best = min(best, v).
Use -inf for negative infinity. Inf is also a name that can be typed directly in an expression.
Input arguments
n, sz1, ..., szN- Non-negative integers with the sizes. Zero gives an empty array.
classname'double'(default) or'single'.
Output arguments
x- Array of
Infvalues.
Example
Infinity arrays
inf
x = inf(2, 3)
y = inf(1, 3, 'single');
class(y)
1/0 == inf
Output
ans = Inf
x = 2×3
Inf Inf Inf
Inf Inf Inf
ans = 'single'
ans = logical
1