Dixed octave 1 sem 08
This commit is contained in:
parent
5c032a0c67
commit
3038462693
3 changed files with 10 additions and 10 deletions
|
|
@ -1 +1 @@
|
||||||
4.80000000e+01 4.90000000e+01 5.00000000e+01 5.10000000e+01 5.20000000e+01 5.30000000e+01 5.40000000e+01 5.50000000e+01 5.60000000e+01 5.70000000e+01 6.50000000e+01 6.60000000e+01 6.70000000e+01 6.80000000e+01 6.90000000e+01 7.00000000e+01
|
5.57723556e-02 6.18259972e-02 7.98947203e-02 2.71162431e-02 6.37453167e-02 8.71123083e-02 8.88742443e-02 1.82390433e-02 6.37323245e-02 6.03478328e-02 4.92268298e-02 9.44843959e-02 5.16590978e-02 4.35413506e-02 9.22707448e-02 6.21571951e-02
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,16 @@ V=33;
|
||||||
rand("state", V);
|
rand("state", V);
|
||||||
|
|
||||||
#stage 7
|
#stage 7
|
||||||
alph = char([48:57 65:70]);
|
alph = char(['0':'9' 'A':'F']);
|
||||||
save -ascii "hex.txt" alph;
|
r = rand(1, 16);
|
||||||
|
ralph = r./sum(r);
|
||||||
|
save -ascii "hex.txt" ralph;
|
||||||
|
|
||||||
#stage 8
|
#stage 8
|
||||||
code = arrayfun(@(n)dec2bin(n, 4), 0:15, "UniformOutput", false);
|
code = arrayfun(@(n)dec2bin(n, 4), 0:15, "UniformOutput", false);
|
||||||
dlmwrite('code.txt', char(code), '');
|
dlmwrite('code.txt', char(code), '');
|
||||||
|
|
||||||
#stage 9
|
#stage 9
|
||||||
r = rand(1, 16);
|
|
||||||
ralph = r./sum(r);
|
|
||||||
for i = 1:100
|
for i = 1:100
|
||||||
msg = gen_msg(ralph, 10);
|
msg = gen_msg(ralph, 10);
|
||||||
encoded = encode_msg(msg, code);
|
encoded = encode_msg(msg, code);
|
||||||
|
|
@ -22,10 +22,10 @@ for i = 1:100
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
m_len = alph_entropy(ralph);
|
||||||
a_len = avg_len(code, ralph);
|
a_len = avg_len(code, ralph);
|
||||||
min_avg_len = min_bits(length(alph));
|
rel_opt = m_len/a_len;
|
||||||
min_len = min(arrayfun(@length, code));
|
|
||||||
rel_opt = alph_entropy(ralph)/(log2(length(ralph)) * a_len);
|
results = [a_len, m_len, min_bits(length(ralph)), rel_opt];
|
||||||
results = [a_len, min_avg_len, min_len, rel_opt];
|
|
||||||
|
|
||||||
save -ascii "results.txt" results;
|
save -ascii "results.txt" results;
|
||||||
|
|
@ -1 +1 @@
|
||||||
4.00000000e+00 4.00000000e+00 1.00000000e+00 2.44102196e-01
|
4.00000000e+00 3.90563513e+00 4.00000000e+00 9.76408783e-01
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue