?? entropy.m
字號:
function h=entropy(p)
% H=ENTROPY(P) returns the entropy function of
% the probability vector p.
if length(find(p<0))~=0,
error('Not a prob. vector, negative component(s)')
end
if abs(sum(p)-1)>10e-10,
error('Not a prob. vector, components do not add up to 1')
end
h=sum(-p.*log2(p));
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -