Borrar filtros
Borrar filtros

How to convert NaN value to 'zero' ?

3 visualizaciones (últimos 30 días)
Ararat Cetinkaya
Ararat Cetinkaya el 23 de Mzo. de 2020
Comentada: Image Analyst el 23 de Mzo. de 2020
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

Respuestas (1)

darova
darova el 23 de Mzo. de 2020
Use isnan
Enthropy(isnan(Enthropy)) = 0;
  3 comentarios
darova
darova el 23 de Mzo. de 2020
I don't understand
Image Analyst
Image Analyst el 23 de Mzo. de 2020
Yes, of course. Why would it not be?

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by