atan2(0,0) is not undefined (NaN)
Mostrar comentarios más antiguos
I'm using MATLAB R2020a Home Edition on a Windows® machine. I have a need to calculate atan2(0,0) which, if I am correct should result in NaN (undefined). The answer I get is zero. Is this not bug in the underline algorithm for computation of atan2()?
Thank you in advance.
Respuesta aceptada
Más respuestas (2)
James Tursa
el 11 de Ag. de 2020
0 votos
This is a documented convention.
1 comentario
Daven Gooden
el 11 de Ag. de 2020
hosein Javan
el 11 de Ag. de 2020
0 votos
it is not a bug. although in analytic math it is undefined, the trigonometric functions are usually calculated by their taylor series expansion on numerical softwares. no doubt it results zero. however when you try very small values, it is still correct:
atan2(1e-301,1e-301)*180/pi
ans =
45
Categorías
Más información sobre Resizing and Reshaping Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!