Mostrar comentarios más antiguos
A = [0.15 0.14 0 0.1 0.19 0.1 0.23 0.09];
SCE = sum(-1.*A.*log2(A))
このような計算をするとSCE部分がNaNというのが出てきてエラーになってしまいます。
Aの合計を1にするようにしていて
A = [0.15 0.14 0.1 0.1 0.19 0.1 0.13 0.09];
SCE = sum(-1.*A.*log2(A))
にすると普通に計算出来るのでAに0があるとエラーが出るのだと思うのですが、
どのようにすればエラーが起きず普通に計算出来るかが分からない為、教えていただきたいです。
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Just for fun 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!