function E = fuzzy_entropy_shannon(A)
%FUZZY_ENTROPY calculates entropy of a fuzzy set A.
% Syntex: E = fuzzy_entropy_shannon(A)
% E : Entropy of a fuzzy set, scalar or vector depending on A
% scalar if A is a vector, vector if A is a matrix
% A : Fuzzy set A
if (nargin < 1 | nargin > 1)
error('Too many or too few input parameters');
elseif (any(A > 1))
error('A is fuzzy sets. All the elements should be in [0,1]');
end
n = size(A,2);
if (min(min(A))==0)
    minimum=min(A(find(A>0)))*0.0001;
    A=A+minimum*ones(size(A));% !!!! 
end
E = (1/(n*log(2)))*sum(((-A.*log(A))-((1-A).*log(1-A))),2);

