Consider the relative frequencies of letters in general Engl
Consider the relative frequencies of letters in general English plain text (see handout posted on course webpage). Do the reported frequencies sum to 1? Calculate the entropy. You can use Matlab to do the calculation. Relative Frequencies of Letters in General English Plain text From Cryptographical Mathematics, by Robert Edward Lewand
Solution
pro = [0.08167 0.01492 0.02782 0.04253 0.12702 0.02228 0.02015 0.06094 0.06996 0.00153 0.00772 0.04025 0.02406 0.06749 0.07507 0.01929 0.00095 0.05987 0.06327 0.09056 0.02758 0.00978 0.02360 0.00150 0.01974 0.00074];
a = size(pro);
temp = 0;
sum=0;
for inc = 0:a
i = -pro(inc)*log(2,pro(inc));
temp = temp + i;
sum = sum + pro(inc);
end
disp(\'entropy\',temp);
if(sum==1.0000)
disp(\'probabilityReportedto1\');
else
disp(\'probabilityNotReportedto1\');
end
Answer:
entropy 4.1764911000
probablityNotReportedto1
