%%%%%%%%%
function H = Hetp(X, p, m, K)

H = 0;
for i = 1:m
    for j = 1:K
        H = H + p(i,j)*log(p(i,j));
    end
end
H = H/m;