Clear Filters
Clear Filters

How to find the smallest entropy value greater than 88 bits from a given alphabet

2 views (last 30 days)
function [b, n] = calc_info(msg, alph, alph_p)
size_alph = numel(alph);
size_alph_p = numel(alph_p);
size_msg = numel(msg);
if size_alph != size_alph_p
error('size "alph" and size "alph_p" must be equal!\nsize alph = %d\nsize alph_p = %d', size_alph, size_alph_p);
endif
b = 0;
for i = 1:size_msg
curr_sim = msg(i);
letter_ind = find(alph == curr_sim);
if ~isempty(letter_ind)
letter_p = alph_p(letter_ind);
b += -log2(letter_p);
else
warning('The character "%c" was found on index %d, the character does not exist in the alphabet', curr_sim, i);
size_msg -= 1;
endif
endfor
n = size_msg * log2(size_alph);
endfunction
How to find the smallest entropy value greater than 88 bits from a given alphabet if I have an alphabet
msg = gen_msg(ralph, 16);
ralph = [0.070528 0.016009 0.036127 0.055553 0.0021791 0.064258 0.1228 0.055277 0.10757 0.12383 0.0026316 0.001682 0.056237 0.12381 0.058622 0.10289]
Please help! Many thanks!

Answers (0)

Community Treasure Hunt

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

Start Hunting!