This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Check whether symbolic array elements are infinite





isinf(A) returns an array of the same size as A containing logical 1s (true) where the elements of A are infinite, and logical 0s (false) where they are not. For a complex number, isinf returns 1 if the real or imaginary part of that number is infinite or both real and imaginary parts are infinite. Otherwise, it returns 0.


Determine Which Elements of Symbolic Array Are Infinite

Using isinf, determine which elements of this symbolic matrix are infinities:

isinf(sym([pi NaN Inf; 1 + i Inf + i NaN + i]))
ans =
  2×3 logical array
     0     0     1
     0     1     0

Determine if Exact and Approximated Values Are Infinite

Approximate these symbolic values with the 50-digit accuracy:

V = sym([pi, 2*pi, 3*pi, 4*pi]);
V_approx = vpa(V, 50);

The cotangents of the exact values are infinite:

ans =
[ Inf, Inf, Inf, Inf]
ans =
  1×4 logical array
     1     1     1     1

Nevertheless, the cotangents of the approximated values are not infinite due to the round-off errors:

ans =
  1×4 logical array
     0     0     0     0

Input Arguments

collapse all

Input value, specified as a symbolic number, variable, expression, or function, or as an array, vector, or matrix of symbolic numbers, variables, expressions, functions.


  • For any A, exactly one of the three quantities isfinite(A), isinf(A), or isnan(A) is 1 for each element.

  • The elements of A are recognized as infinite if they are

    • Symbolic Inf or -Inf

    • Sums or products containing symbolic Inf or -Inf and not containing the value NaN.

Introduced in R2013b

Was this topic helpful?