Afficher commentaires plus anciens
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があるとエラーが出るのだと思うのですが、
どのようにすればエラーが起きず普通に計算出来るかが分からない為、教えていただきたいです。
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Just for fun dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!