필터 지우기
필터 지우기

How to convert NaN value to 'zero' ?

조회 수: 3 (최근 30일)
Ararat Cetinkaya
Ararat Cetinkaya 2020년 3월 23일
댓글: Image Analyst 2020년 3월 23일
Hi Everybody,
I have an equation like this "Enthropy = (-p2/b)*log2(p2/b)". p2 values changing according to another equation and When p2 value gets '0', Enthropy value gets to NaN. is there any way to Conver this NaN to '0' value?
For example
when : p2/b = 4
Enthropy = -4*log2(4) = -8
when : p2/b = 0
Enthropy = -0*log2(0) = 0

답변 (1개)

darova
darova 2020년 3월 23일
Use isnan
Enthropy(isnan(Enthropy)) = 0;
  댓글 수: 3
darova
darova 2020년 3월 23일
I don't understand
Image Analyst
Image Analyst 2020년 3월 23일
Yes, of course. Why would it not be?

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by