]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/matlab/STC matlab implementation/example2.m
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
621f0472ef7b50b054e00f0c0e53e1783e4295ee
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / matlab / STC matlab implementation / example2.m
1 clc; clear;
2
3 % either use optimized matrix H_hat
4 load('dv_best_submatrices.mat');
5 H_hat = double(submatrices{3,7}); % constraint length 7 and width 3.
6 % Not all combinations are known.
7
8 H = create_pcm_from_submatrix(H_hat, 50);
9 draw_pcm(H);
10
11 % code = structure with all necesary components
12 code = create_code_from_submatrix(H_hat, 50);
13 w = ones(code.n,1);
14 x = double(rand(code.n,1)<0.5);
15 m = double(rand(sum(code.shift),1)<0.5);
16
17 [y min_cost] = dual_viterbi(code, x, w, m);
18
19 if (all(m'==calc_syndrome(code,y)'))
20     fprintf('Message extracted without any error.\n');
21 else
22     fprintf('ERROR\n');
23 end
24
25 min_cost