% Entropy script

W = [ 1/2 1/2 0; 1/4 0 3/4 ; 1/2 1/2 0 ];
p = [ 5/12 1/3 1/4] % stationary distribution for W

[m,n] = size(W);
Pmat = repmat(p',1,n);
PXY = Pmat.*W;        

PY = p*W
PYmat = repmat(PY,m,1);
PXgY = PXY./PYmat;

HX = entropy2(p)
HY = entropy2(PY)
HXY = entropy2(PXY)
HYgX = entropy2(W,PXY)
HXgY = entropy2(PXgY,PXY)