What's the point of 'isinf' function ?
Afficher commentaires plus anciens
In MATLAB we can use '==' operator to check whether the given variable is a finite or infinite. I'm wondering is there any advantages of using 'isinf' function ? like improvement in execution time or handling of some execptions. Any information is helpful. Thank you.
Réponse acceptée
Plus de réponses (1)
For one thing, it covers cases were the inf elements have mixed signs, thus avoiding the overhead of additional operations like abs().
isinf([-inf, 2, inf, 5])
5 commentaires
Infinite_king
le 5 Jan 2024
Modifié(e) : Infinite_king
le 5 Jan 2024
isinf can be useful for complex inputs if desired that either real or imaginary part being inf should return true.
x = inf + 1i
inf == x
isinf(x)
x = 1 + 1i*inf
isinf(x)
Huh, looks like it tests the imaginary component as well !
Infinite_king
le 8 Jan 2024
Catégories
En savoir plus sur Numeric Types dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!