📄 entropy.m
字号:
function h=entropy(p)
%H=ENTROPY(P)返回概率矢
%量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 + -