how to find entropy of X.

how i implement this entropy formula(PNG file atached) in matlab code
my X is Column c in xlsx file(attached) i want to find for 1000 value

11 Comments

John D'Errico
John D'Errico on 22 Dec 2018
Edited: John D'Errico on 22 Dec 2018
Why not just download the yalmip toolbox, which has entropy already implemented? Is here for download:
i did't find
See the comments of
there is an implementation in the comments .
There is a function in the image processing toolbox for the greyscale image case.
Thankx alot its work for me y = [1 -6011 -3000 2592]):
this code find the entropy
function [ent] = EntropyInt(y)
% Calculate the entropy for an integer value of y
% First verify that y is truely integer-valued
Sum = sum(y);
if( Sum ~= round(Sum) )
error('INTEGER_ENTROPY:InvalidInput', 'Input arguments must be of integer value.')
end
% Generate the histogram
[n x] = hist(y, double(min(y):max(y)));
% Normalize the area of the histogram to make it a pdf
n = n / sum(n);
% Calculate the entropy
indices = n ~= 0;
ent = -sum(n(indices).*log2(n(indices)));
end
indices = n ~= 0; i did't understand this line what does it mean
log(0) is minus infinity, so n~= zero finds those bins where the value (number of counts in the histogram bin) is non-zero. So only those are passed into log2(), thus preventing a "-inf" result.
thanks for your answer.. how can i find the join entropy ?
What is that? Do you have a formula?
yes snap shot is attached kindly see
u got it??

Sign in to comment.

 Accepted Answer

Image Analyst
Image Analyst on 23 Dec 2018
You can try entropy() or entropyfilt() in the Image Processing Toolbox, if you have it. entropyfilt() does a sliding window computation of entropy whereas entropy does it for the whole array.

2 Comments

thanks for your ans its related to probability
We know that.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!