UPC/1sem/octave/04/alph_entropy.m
2019-11-22 22:51:59 +07:00

4 lines
86 B
Mathematica

function [h] = alph_entropy(P);
P = P(P ~= 0);
h = -sum(P.*log2(P));
endfunction;