Saturday, November 27, 2010

Entropy Plot for a fair coin toss

Entropy Plot for a fair coin toss

(Yes png as pdflatex does not take eps or pdf format.)
...

clear all
close all
p = 0.0:0.0001:1
entropy = -(p.*log2(p))-((1-p).*log2(1-p)); % in bits try logp to see in nats
figure;
h = plot(p,entropy);
axis tight;
mypretty(h,'Probability','Entropy (bits)','Entropy versus probability for a coin toss')
set(gca, 'LooseInset', [0,0,0,0]);
saveas(h, 'entropy_parabola.png')

No comments: