Show older comments
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があるとエラーが出るのだと思うのですが、
どのようにすればエラーが起きず普通に計算出来るかが分からない為、教えていただきたいです。
Accepted Answer
More Answers (0)
Categories
Find more on Just for fun in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!