if (length(find(P<=0))~=0)
error('Not a prob.vector,negative component');
error('Not a prob.vector,component do not add up to 1');
end
H=(sum(-P.*log2(P)))/(log2(r)+eps);
function [s,L,q]=shannon(p)
%if(length(find(p<=0))~=0)
% error('Not a prob.vector,negative component');
%if(abs(sum(p)-1)>10e-10)
% error('Not a prob.vector,component do not add up to 1')
[p,x]=array(p,x);
l=ceil(-log2(p));
P(1)=0;
for j=1:l(i)
temp(i,j)=floor(P(i)*2);
P(i)=P(i)*2-temp(i,j);
end
评论0
最新资源