Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
7
Task/Entropy/MATLAB/entropy-1.m
Normal file
7
Task/Entropy/MATLAB/entropy-1.m
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
function E = entropy(d)
|
||||
if ischar(d), d=abs(d); end;
|
||||
[Y,I,J] = unique(d);
|
||||
H = sparse(J,1,1);
|
||||
p = full(H(H>0))/length(d);
|
||||
E = -sum(p.*log2(p));
|
||||
end;
|
||||
2
Task/Entropy/MATLAB/entropy-2.m
Normal file
2
Task/Entropy/MATLAB/entropy-2.m
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
> entropy('1223334444')
|
||||
ans = 1.8464
|
||||
Loading…
Add table
Add a link
Reference in a new issue