What's the point of 'isinf' function ?
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (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 comentarios
Infinite_king
el 5 de En. de 2024
Editada: Infinite_king
el 5 de En. de 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
el 8 de En. de 2024
Categorías
Más información sobre Numeric Types en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!