1sem matlab 05

This commit is contained in:
Andrew 2019-11-29 08:11:27 +07:00
parent 41d0b979d1
commit 018bac4688
5 changed files with 110 additions and 0 deletions

27
1sem/octave/05/main.m Normal file
View file

@ -0,0 +1,27 @@
#stage 3
V=33
rand("state", V)
#stage 4
alph = char([48:57 65:70]);
r = rand(1, 16);
ralph = r./sum(r);
save -ascii "ralph.txt" ralph;
#stage 5
h = alph_entropy(ralph);
r = alph_redundancy(ralph);
#stage 6
msg = gen_msg(ralph, 100);
dlmwrite("msg.txt", msg, '');
#stage 7
[b, n] = calc_info(msg, alph, ralph);
#stage 8
avg_b = b / length(msg);
#stage 9
results = [b, n, avg_b, h, r]
save -ascii "results.txt" results;