NaN vs. Inf

조회 수: 1 (최근 30일)
Laurence Lurio
Laurence Lurio 2011년 12월 31일
Why is
1/0 = Inf
but
[1,0]./[1,0] = [1 NaN]
shouldn't it be [1 Inf]?

채택된 답변

Image Analyst
Image Analyst 2011년 12월 31일
1/0 is infinity, but 0/0 is not infinity nor is it zero - it's just undefined (NaN).
  댓글 수: 1
Matt Tearle
Matt Tearle 2011년 12월 31일
And if you want to know *why*, think in terms of limits. lim_{x->0} 1/x = infinity. But lim_{x->0} x^2/x = 0, lim_{x->0} x/x = 1, and lim_{x_>0} x/x^2 = infinity. So there's no way to determine what a "0/0" limit might be. Hence, it's undefined (NaN).
Similarly, Inf + Inf = Inf, but Inf - Inf = NaN.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Jose Jeremias Caballero
Jose Jeremias Caballero 2011년 12월 31일
Hi.
[1,0]./[1,0]= [1/1,0/0]=[1,NaN]
  댓글 수: 1
Jan
Jan 2012년 1월 1일
The question is, why 0/0=NaN and not Inf.

댓글을 달려면 로그인하십시오.


Jose Jeremias Caballero
Jose Jeremias Caballero 2012년 1월 2일

카테고리

Help CenterFile Exchange에서 Detection, Range and Doppler Estimation에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by